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:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n = II()
    a = LI()
    a.sort()
    print(sum(a[n::2]))
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
#stdin = open("input.txt")

if __name__ == "__main__":
    N = int(stdin.readline())
    a = [int(item) for item in stdin.readline().split()]

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

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

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()
answer = sum(A[N::2])
print(answer)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
a = sorted(map(int, input().split(' ')), reverse=True)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

nums = sorted(list(map(int, input().split())))

res = 0
for i in range(N):
    res += nums[3 * N - 2 * (i+1)]

print(res)

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 = sorted([int(i) for i in input().split()], reverse=True)

ans = []
for i in range(1, len(a), 2):
    if len(ans) < N:
        ans.append(a[i])

print(sum(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

res = 0
sortedA = sorted(A, reverse=True)
for i in range(1, N*2+1, 2):
    res += sortedA[i]

print(res)

Submission status: Accepted

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

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

print(ret)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, a: "List[int]"):
    
    a.sort(reverse=True)

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

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(3 * N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    a = list(map(int, readline().split()))
    a.sort(reverse=True)
    t = 0
    for i in range(1, n * 2, 2):
        t += a[i]
    print(t)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

b = [a[i] for i in range(len(a)) if i%2 == 0]

print(sum(b))

Submission status: Accepted

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

syo = a[0:n]
tyu = a[n:2*n]
dai = a[2*n:3*n]

l = a[n:3*n]
sec = l[0::2]

print(sum(sec))

Submission status: Accepted

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

a.sort(reverse=True)

a.pop(0)
for i in range(n):
    a.pop(-1)

count = 0
for i in range(len(a)):
    if i % 2 == 0:
        count += a[i]
    else:
        continue

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = [int(a) for a in input().split()]
    A = sorted(A,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)

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

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

print(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 + 1:2]))

Submission status: Accepted

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

Submission status: Accepted

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

a = sorted(a)

ans = 0

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

Submission status: Accepted

Solution code:
import sys
import numpy as np

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

#上から貪欲法
N = ri()
A = np.array(rl())
A.sort()
answer = A[-2:-1-2*N:-2].sum()
print(answer)
#35

Submission status: Accepted

Solution code:


def main()->None:
    # 解説見た
    # 強さを弱い順に並べて、初めからN番目までは各チームの１番弱い人
    # N番から２N番は各チームで２番目に強い人
    N = int(input()) # team数
    a = list(map(int, input().split()))
    sorted_a = sorted(a)
    
    sum_a = 0 # ２番目の人の和
    range_N = range(N)
    for i in range(N):
        sum_a += sorted_a[3*N - 2*i - 2]
    print(sum_a)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

sum = 0
a.sort()

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

a = sorted(a, reverse=True)
m = 0

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

print(m)

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[i * 2 + 1]

print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    lst = list(map(int, input().split()))

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

A.sort()
ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
member = sorted(list(map(int,input().split())))
rest = member[n:]
represent = []
for i in range(0,2 * n,2):
  represent.append(rest[i])
print(sum(represent))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
men = []
cnt = 0

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

Submission status: Accepted

Solution code:
from collections import deque

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

A = sorted(A)
dq = deque(A)
ans = 0

while dq:
    dq.popleft()
    dq.pop()
    ans += dq.pop()

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,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=1)
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 = list(map(int, input().split()))

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

Submission status: Accepted

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

Submission status: Accepted

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


a.sort()

ans = 0

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

print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split())
a.sort()
print(sum(i for i in a[-2:n-1:-2]))

Submission status: Accepted

Solution code:
N = int(input())
strengths = map(int, input().split())
sorted_strengths = sorted(strengths, reverse=True)
# print(sorted_strengths)
team_strength_sum = 0
for i in range(3*N):
    if ((i+1)%2 == 0) & ((i+1)//2 <= N):
        team_strength_sum += sorted_strengths[i]
print(team_strength_sum)

Submission status: Accepted

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

N = int(input().split()[0])
a_list = list(map(int, input().split()))
a_list = sorted(a_list, reverse=True)

# N組できる
x_list = a_list[: 2 * N]
ans = sum([x for i, x in enumerate(x_list) if i % 2 == 1])

print(ans)

Submission status: Accepted

Solution code:
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N = int(sys.stdin.buffer.readline())
A = list(map(int, sys.stdin.buffer.readline().split()))

A.sort(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()
ans = 0
for i in range(N, 3 * N, 2):
    ans += a[i]

print(ans)

Submission status: Accepted

Solution code:
def main():
  N = int(input())
  a = list(map(lambda i: int(i), input().split(' ')))
  a.sort()
  a.reverse()
  max_point = 0
  for i in range(0, 2 * N):
    if i % 2 == 1:
      max_point += a[i]
  print(max_point)

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
members = [int(x) for x in input().split()]
members.sort(reverse=True)
strongness = 0
for i in range(n):
    strongness += members[2*i+1]
print(strongness)

Submission status: Accepted

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

a.sort(reverse=True)

b = a[1::2]

print(sum(b[:N]))

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:
# -*-coding: utf-8 -*-
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()
a.reverse()

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N=int(input())
A=list(map(int,input().split()))
A.sort()

count=0
for _ in range(N):
    A.pop(-1)
    count+=A.pop(-1)
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

    a.sort()

    ans = 0
    for e in a[-2:n-1:-2]:
        ans += e

    print(ans)


if __name__ == "__main__":
    main()

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 = 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 = list(map(int, input().split()))

a_list.sort()

target_total = 0
for j in range(N, 3 * N, 2):
    target_total += a_list[j]

print(target_total)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(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(reverse = True)
sum = 0
for i in range(n):
    sum += a[i * 2 + 1]
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(0,2*n):
    if i%2!=0:
        ans+=a[i]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
import sys,bisect,math,itertools,string,queue
from heapq import heappop, heappush
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpl()
a.sort()
res = 0
ind = n
for i in range(n):
    if i == 0:
        res += a[ind]
        continue
    ind += 2
    res += a[ind]
print(res)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    a.sort(reverse=True)
    print(sum(a[1:n*2:2]))


if __name__ == '__main__':
    slove()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    a.sort(reverse=True)
    t = 0
    for i in range(1, 2 * n, 2):
        t += a[i]
    print(t)


if __name__ == '__main__':
    slove()

Submission status: Accepted

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

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()))
A.sort()

ans = 0
for a in A[N:: 2]:
    ans += a

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = sum([v for i, v in enumerate(A) if i % 2 == 1 and i <= 2 * N])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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:
def solve(n, a):
    return sum(sorted(a)[::-1][1:2*n:2])

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

A.sort(reverse=True)
#print(A[1:2*N:2])
print(sum(A[1:2*N: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(n):
        ans += a[2 * i + 1]
    print(ans)


if __name__ == "__main__":
    resolve()

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:
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    a.sort(reverse=True)
    ans = []
    for i in range(1, n * 3, 2):
        ans.append(a[i])
        if len(ans) == n:
            print(sum(ans))
            exit()


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
# AGC012A - AtCoder Group Contest
def main():
    # sort -> first 1/3 as smallest ones
    # the sum of 2nd ones: 1111 23 23 23 23
    N, *A = map(int, open(0).read().split())
    A.sort()
    ans = sum(A[N::2])
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = input().split()
a = [int(i) for i in a]
a = sorted(a)
 
candidate = a[n:len(a)+1]
print(sum([candidate[i] for i in range(0, 2*n, 2)]))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = int(0)
#一番チームで最弱のやつを取り出す

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

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    _ = int(input())
    A = list(map(int, input().split()))
    A.sort()
    q = collections.deque(A)
    ans = 0
    while q:
        q.popleft()
        q.pop()
        ans += q.pop()
    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(sum(a[1::2][:N]))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sumn)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
*A, = 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(reverse = True)
x = 0

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

a_s = input().split()

for i in range(3*N):
  a_s[i] = int(a_s[i])
  
a_s = sorted(a_s)

a_1 = a_s[:N]
a_2 = a_s[N:]

ans = sum(a_2[0::2])

print(ans)

Submission status: Accepted

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

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

print(score)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
a.sort()
from collections import deque
a=deque(a)
ans=0
for i in range(n):
    d=a.pop()
    ans+=a.pop()
    d=a.popleft()
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[2*i+1]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
arr = list(map(int, input().split(" ")))
arr.sort()
# print(arr)

new_arr = arr[n::2]
print(sum(new_arr))

Submission status: Accepted

Solution code:
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:
if __name__ == '__main__':
    N = int(input())
    a = list(map(int, input().split()))
    a.sort()
    a_new = a[N:N * 3:2]
    total = sum(a_new)
    print(total)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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:
import sys
N=int(sys.stdin.readline())
l = [int(i) for i in sys.stdin.readline().split()]
l.sort()
print(sum(l[N::2]))

Submission status: Accepted

Solution code:
import sys
N=int(sys.stdin.readline())
l = list(map(int,sys.stdin.readline().split()))
l.sort()
print(sum(l[N::2]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    a.sort(reverse=True)
    print(sum(a[1:2*n+1:2]))


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n = I()
    a = LI()
    a.sort(key = lambda x:-x)
    ans = 0
    for i in range(n):
        ans += a[2*i+1]
    print(ans)
    return

#B
def B():
    def dfs(d,x,c):
        if d <= dp[x]:
            return
        dp[x] = d
        if not f[x]:
            f[x] = c
        for y in v[x]:
            dfs(d-1,y,c)
    n,m = LI()
    f = [0]*n
    v = [[] for i in range(n)]
    for i in range(m):
        a,b = LI()
        a -= 1
        b -= 1
        v[a].append(b)
        v[b].append(a)
    dp = defaultdict(lambda : -1)
    q = I()
    l = LIR(q)
    l = l[::-1]
    for x,d,c in l:
        x -= 1
        dfs(d,x,c)
    for i in f:
        print(i)
    return

#C
def C():
    n = I()

    return

#D
def D():
    n = I()

    return

#E
def E():
    n = I()

    return

#F
def F():
    n = I()

    return

#Solve
if __name__ == "__main__":
    A()

Submission status: Accepted

Solution code:
# A - AtCoder Group Contest
N = int(input())
A = list(map(int, input().split()))
i = 1
ans = 0
A.sort(reverse=True)

while i <= 2*N:
    ans = ans + A[i]
    i += 2

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
ans = 0
for i in range(3*n):
  if i >= n and (i-n) % 2 == 0:
    ans += a[i]
print(ans)