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())
s = input()
data = []
for it in s.split():
    data.append(int(it))
data.sort()

rest = data[n:]
print(sum(rest[::2]))

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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,*a=map(int,open(0).read().split());print(sum(v for k,v in enumerate(sorted(a)[n:])if k%2<1))

Submission status: Accepted

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

a3n = sorted(a3n,reverse=True)

print(sum(a3n[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 A[1:2*N:2]:
    ans += i

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def solve():
  n= int(input())
  a = list(int(i) for i in input().split())
  a.sort() 
  #前から一*n人削除
  a = a[n::]
  #後から二人分削除
  ans = 0
  for i in range(2*n):    
   if i%2 == 0: ans += a[i]
  return ans
  
  
if __name__ == '__main__':
  print(solve())

Submission status: Accepted

Solution code:
# coding:utf-8

import sys
# from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 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 LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    n = II()
    A = LI()
    A.sort()
    A.reverse()
    res = 0
    for i in range(n):
        res += A[1 + i * 2]

    return res


print(main())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

A.sort()

res = 0
count = 0
for i in range(1, 3 * N):
    if i%2 == 0:
        res += A[-i]
        count += 1
        
    if count == N:
        break
    
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Fri Mar  1 00:32:34 2019

@author: yuta
"""

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

def main(n,a):
    b = sorted(a,reverse = True)
    c = b[:(2*n+1)]
    d = c[1::2]
    max_sum = sum(d)
    print(max_sum)
main(N,a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
n=int(input())
A=list(map(int,input().split()))
A.sort()
print(sum(A[-2:-2*n-1:-2]))

Submission status: Accepted

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


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


if __name__ == '__main__':
    main()

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#AGC012A
#answer
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())
print(sum(sorted([int(i) for i in input().split()], reverse=True)[1:n*2:2]))

Submission status: Accepted

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

Submission status: Accepted

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

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(list(map(int, input().split())), reverse=True)
print(sum(a[1:n * 2: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 solve(N, As):
    As.sort()
    return sum([n for n in As[N::2]])

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

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 = sorted(A)

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

Submission status: Accepted

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

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

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

N = INT()
aN = LIST()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

a.sort()
a.reverse()

ans = 0

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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


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


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

Submission status: Accepted

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

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

Submission status: Accepted

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

inputs.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest-
#  Atcoder_Grand_Contest012-A
#  https://atcoder.jp/contests/agc012/tasks/agc012_a

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


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

Submission status: Accepted

Solution code:
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest-
#  Atcoder_Grand_Contest-
#  TODO https://atcoder.jp/contests/abc/tasks/abc_
import time
from contextlib import contextmanager
# from time import sleep
@contextmanager
def timer(title):
	t0 = time.time()
	yield
	print("{} - done in {:.0f}s".format(title,time.time()-t0) )

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


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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N=int(input())

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

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

Submission status: Accepted

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


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

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

    print(total)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
a = list(reversed(sorted(a)))
# 2番目を最大にするとは
# 大きいものを各組に2つずつ割り振るべき
# a > b > c > dなら[[a,b][c,d]]か[[a,c][b,d]]なので
# つまり出力は大きい順に並べたうちで、上から奇数番目のNつの和
sum = 0
for i in range(2*n):
    if i % 2 == 1:
        sum += a[i]
        # print(a[i])
print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def inpl(): return [int(i) for i in input().split()]
N = int(input())
a = list(reversed(sorted(inpl())))
ans = 0
for i in range(N):
    ans += a[2*i+1]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

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

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

Submission status: Accepted

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

    i = 0
    j = 3 * n - 1

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

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
print(sum(sorted(map(int, input().split()))[N:3*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, len(a), 2):
    ans += a[i]
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

a.sort()
a.reverse()

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

Submission status: Accepted

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

a.sort()
a.reverse()

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

As.sort()

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

a = sorted(a, reverse=True)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a.sort()

total = 0

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

print(total)

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

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

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

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

a.sort(reverse=True)

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

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())
l=sorted(map(int,input().split()))
print(sum(l[i] for i in range(n,3*n,2)))

Submission status: Accepted

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

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

Submission status: Accepted

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

v.sort()

taken = 0
sum = 0

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

	if taken == n:
		break

print sum

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

arr.sort()

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

print ans

Submission status: Accepted

Solution code:
n = int(input())

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

a.sort()
a.reverse()

ans = 0

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

Submission status: Accepted

Solution code:
from collections import deque


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

B = deque(A)

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

Submission status: Accepted

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

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

print(r)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

inp.sort()
inp.reverse()

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

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# AtCoder Beginner Contest


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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
def debug(*args): print(*args, file=sys.stderr)
def exit(): sys.exit(0)

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

a.sort()

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
def a_atCoder_group_contest(N, A):
    A.sort(reverse=True)
    ans = sum(A[1:2 * N:2])  # Aが0-indexedなので、 1, 3,..., 2N-1 番の和をとる
    return ans

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a = list(map(int, input().split()))
 
    a.sort(reverse=True)
    s = 0
    for i in range(n):
        s += a[i*2+1]
 
    print(s)
 
 
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

    print(s)


if __name__ == '__main__':
    main()

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())),reverse=True)[1::2][:N]

print(sum(A))

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

Submission status: Accepted

Solution code:
import sys

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

import sys, math, copy
# import fractions, itertools
# import numpy as np
# import scipy

HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"

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

main()

Submission status: Accepted

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

Submission status: Accepted

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

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