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:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    tot = 0
    for i in range(N):
        tot += A[3*N-2-2*i]
    return tot
if __name__ == '__main__':
    print(main())

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 = sorted(a, reverse=True)
num = 0
for i in range(1, 2 * N + 1):
    if i % 2 == 1:
        num += a[i]

print(num)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
#AGC012A
import sys
import collections

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

#print(a)
a.sort()
#print(a)

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

Submission status: Accepted

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

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Submission status: Accepted

Solution code:
import sys
N = int(sys.stdin.readline().rstrip())
a = sorted(list(map(int, sys.stdin.readline().rstrip().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)
ans = 0
for i in range(N*2):
  if i % 2 != 0:
    ans += a[i]
  else:
    pass
  
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
array = [int(i) for i in input().split()]

list.sort(array, reverse=True)
ans = 0

#nkara2nmade

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(sorted(list(map(int,input().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 = input().split()
for i in range(3*n):
	a[i] = int(a[i])

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:
#!/usr/bin/env python3
import sys, math, fractions, itertools, collections, copy, heapq


def solve(N: int, a: "List[int]"):
    a = sorted(a, reverse=True)
    print(sum(a[:2*N][1::2]))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main(): 
    N = II()
    a_li = LI()  # 3N

    a_li.sort()

    a_li = a_li[N::2]
    print(sum(a_li))


    # print('Hello world!')



main()

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/agc012/tasks/agc012_a

N = int(input())
a = list(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)

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()) * 3
A = sorted([int(_) for _ in input().split()])
ans = 0

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

Submission status: Accepted

Solution code:
member = int(input())
member_array = sorted(list(map(int, input().split())),reverse=True)
result = 0
count = 1

for i in range(member):
    result += member_array[count]
    count += 2

print(result)

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())
l=list(map(int,input().split()))
l=sorted(l,key=lambda x:x,reverse=True)
s=0
ind=1
while True:
  s+=l[ind]
  ind+=2
  if ind>2*n:
    break
print(s)

Submission status: Accepted

Solution code:
N = int(input())
li = list(map(int,input().split()))
li.sort(reverse = True)
total = []
for i in li[1:2 * N:2]:
  total.append(i)
print(sum(total))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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

Submission status: Accepted

Solution code:
teams = int(input())
strongs = sorted([int(i) for i in input().split()],reverse= True)

result = 0
for j in range(teams):
    result += strongs[1+j*2]

print(result)

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:
n = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
except_weak = a_list[n:]

ans = sum(except_weak[::2])
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
players_powers = sorted(list(map(int, input().rstrip("\n").split())), reverse=True)

print(sum(players_powers[1::2][:n]))

Submission status: Accepted

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

N = int(input())
A = [int(x) for x in input().split()]
A.sort()
answer = sum(A[N::2])
print(answer)

Submission status: Accepted

Solution code:
# 2019/08/09

n=int(input())
a=sorted(list(map(int,input().split())))
r=3*n-1
cnt=0
for l in range(n):
    cnt+=a[r-1]
    r-=2
print(cnt)

Submission status: Accepted

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

a_sort = sorted(a, reverse=True)

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

print(ans)

Submission status: Accepted

Solution code:
# 3Nを降順に並べると上位1/3が最強で下位1/3が弱い、考えるのは間の1/3だけでいい
# -> なんでこれがWAなの....
# あそうか 4 1 100 14 4 66 31 10 6 4 4 89

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

Submission status: Accepted

Solution code:
n = int(input())
n1= n * 3
arr = sorted(list(map(int,input().split())))
sums = 0
count = 0
for i in range(-1,-n1,-2):
  sums += arr[i-1]
  count += 1
  if count == n:
    print(sums)
    break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import copy

N = int(input())
a = list(map(int, input().split()))
a.sort()
b = copy.deepcopy(a[N:])

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

print(sums)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = 0
index = 3*N-1
i = 0
while i < N:
    ans += A[index-1]
    index -= 2
    i += 1
print(str(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(n):
    count += a[i*2 + 1]
 
print(count)

Submission status: Accepted

Solution code:
# AGC012A - AtCoder Group Contest
def main():
    n = int(input())
    A = sorted(map(int, input().rstrip().split()))
    print(sum(A[n::2]))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# AGC012A - AtCoder Group Contest
def main():
    n = int(input())
    A = sorted(map(int, input().rstrip().split()))[n:]
    print(sum(A[::2]))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

#大きい順にソート
a.sort(reverse=True)

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
data = [int(x) for x in stdin.readline().rstrip().split()]
data = sorted(data)
data = list(reversed(data))
ans = data[:2*N][1::2]
print(sum(ans))

Submission status: Accepted

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

a_sorted = sorted(a_list, reverse=True)
sum_a = 0
for i in range(n):
    sum_a += a_sorted[i * 2 + 1]

print(sum_a)

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())

arr = list(map(int,input().split()))
arr.sort()
arr = arr[::-1]


s = 0

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

print(s)

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

Submission status: Accepted

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


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, typ=int):
    return [typ(input()) for _ in range(n)]


def main():
    n, = read_h()
    a = sorted(read_h(), reverse=True)

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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


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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

n = int(input())
num_list = sorted([ int(v) for v in input().split() ])
print(sum(num_list[n:][::2]))

Submission status: Accepted

Solution code:
from fractions import gcd
def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft



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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print(sum(sorted(list([float(None==exec("N=int(input())"))] + list(map(int, input().split()))), reverse=True,key=lambda x: 10 ** 10 if type(x) == float else x)[2:2*N+1:2]))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import numpy as np


def main():
    n = int(input())
    an = [int(e) for e in input().split()]
    astrong = sorted(an)[n:]
    ans = sum(astrong[i] for i in range(0, n * 2, 2))
    print(ans)


main()

Submission status: Accepted

Solution code:
N = int(input())
li = [int(x) for x in input().split()]
li.sort()
ans = sum([li[N+x*2] for x in range(N)])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

list = input().split(" ")
num_list = []

for num in list:
    num_list.append(int(num))

num_list.sort(reverse=True)
total = 0
count = 0
for i in range(N*3):
    if i % 2 == 1 and count < N:
        total += num_list[i]
        count += 1
        
print(total)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(raw_input())
a_arr = map(int, raw_input().split())

a_arr_sort = sorted(a_arr, reverse=True)

sum_val = 0
for idx in range(0, N):
  temp_val = a_arr_sort[2*idx+1]
  sum_val += temp_val

print(sum_val)

Submission status: Accepted

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

Submission status: Accepted

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

S_A = sorted(A)[::-1]
#print(S_A)
print(sum(S_A[1:2 * N + 1:2]))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
# a1<a2<a3<a4 -> (a4,a3)(a2,a1)
a.sort(reverse=True)
ans = 0
for i in range(N):
    ans += a[i * 2 + 1]
print(ans)

Submission status: Accepted

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

for _ in  range(N):
    nums.pop()
    ans += nums.pop()
print(ans)

Submission status: Accepted

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

sort_a = sorted(a, reverse=True)

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

print(sum_team)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys 
n = int(input())

a = list(map(int, sys.stdin.readline().split()))

sorted_a = sorted(a)
reversed_a = sorted(a, reverse=True)

aa = []
for i in range(n):
    sorted_a.pop(-1)
    reversed_a.pop(-1)
    aa.append(sorted_a.pop(-1))

print(sum(aa))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
A - AtCoder Group Contest
https://atcoder.jp/contests/agc012/tasks/agc012_a

"""
import sys


def solve(N, array):
    array.sort(reverse=True)
    ans = 0
    for i in range(1, 2*N, 2):
        ans += array[i]
    return ans


def main(args):
    N = int(input())
    array = [int(a) for a in input().split()]
    ans = solve(N, array)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

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

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

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:
N=int(input())
A=[int(i) for i in input().split()]
A.sort(reverse=True)
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(reverse=True)

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

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

s = 0
i = N
while i < 3 * N:
    s += a[i]
    i += 2

print(s)

Submission status: Accepted

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

numbers.sort(reverse=True)
ans = 0
order = 1
for j in range(1, n+1):
  ans+=numbers[order]
  order+=2
  
print(ans)

Submission status: Accepted

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

A.sort(reverse=True)
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()
a = a[n:]
print(sum(a[0::2]))

Submission status: Accepted

Solution code:
#A - AtCoder Group Contest 012

n = int(input())
numbers = [int(_) for _ in input().split()]
    
numbers.sort(reverse=True)
ans = 0
order = 1
for j in range(1, n+1):
    ans += numbers[order]
    order += 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+1:2]))

Submission status: Accepted

Solution code:
n=int(input())
print(sum(sorted([int(i) for i in input().split()])[-2:n-1:-2]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(A[-2:-2*N-1:-2]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
ans = 0
a.sort(reverse = True)
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)[:2*N][1::2]))

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n = int(input())
    alist = [int(i) for i in input().split()]
    alist.sort(reverse=True)
    st = 0
    for i in range(n):
        st += alist[2*i+1]
    print(st)

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

Submission status: Accepted

Solution code:
N=int(input())
A=[int(i) for i in 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 = sorted(A, reverse=True)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
list = [int(i) for i in input().split()]
list.sort()
result = 0
for i in list[::-1][1::2][:N]:
  result += i
print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(N):
  c += B[i]

print(c)

Submission status: Accepted

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

san = sorted(an)
print(sum(san[i] for i in range(N, N*3, 2)))

Submission status: Accepted

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

print(sum(ans[:N]))

Submission status: Accepted

Solution code:
import numpy as np
import math
import fractions

class KyoPro:
    @staticmethod
    def ReadNumbers():
        return list(map(int, input().split()))

    @staticmethod
    def MakeStringFromNumbers(a):
        if len(a) == 0:
            return
        s = str(a[0])

        for i in range(1, len(a)):
            s += ' ' + str(a[i])
        
        return s

def main():
    n = int(input())
    a = KyoPro.ReadNumbers()

    a.sort()
    a.reverse()

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

    

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
A.sort(kind='mergesort')
out = 0
for k in range(N):
  out += A[-2*(k+1)]
print(out)

Submission status: Accepted

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

Submission status: Accepted

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