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: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
A.sort(reverse=True)

ans = 0

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

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
A.sort()

ans = 0

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

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
A.sort()

# A = deque(A)

print(sum(A[N+1:N+1+N]))
# ans = 0
# print(A)
# for i in range(N):
#     if i % 2 == 0:
#         ans += A.pop()
#         A.popleft()
#     else:
#         ans += A.popleft()
#         A.pop()
# print(ans)

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
A.sort()

A = deque(A)

ans = 0

for i in range(N):
    if i % 2 == 0:
        ans += A.pop()
        A.popleft()
    else:
        ans += A.popleft()
        A.pop()
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    N=int(input())
    A=sorted(list(map(int,input().split())))
    cnt=N
    p=A[-cnt - cnt:-cnt]
    print(sum(p))



resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    A.sort(reverse = True)
    ans = 0
    for i in range(N):
        ans += (2 * i + 1)
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

print(sum(A[n:2*n]))

Submission status: Wrong Answer

Solution code:
from collections import deque

if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))

    a.sort()
    deq = deque(a)
    for i in range(n):
        deq.pop()
        deq.popleft()

    ans = 0
    for d in deq:
        ans += d

    print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

A=[int(i) for i in input().split()]

A.sort()

sum=0
for i in range(n, n+n):
    sum+=A[i]
print(sum)

Submission status: Wrong Answer

Solution code:
n = int(input())

A=[int(i) for i in input().split()]

A.sort()
k = (n*3)//3
sum=0
for i in range(k, k+n):
    sum+=A[i]
print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
 
N = int(sys.stdin.readline())
a = sorted(list(map(int, sys.stdin.readline().split(" "))), reverse=True)
sum = 0
for i in range(N):
  sum += a[2 * N + 1]
print(sum)

Submission status: Wrong Answer

Solution code:
import sys
 
N = int(sys.stdin.readline())
a = sorted(list(map(int, sys.stdin.readline().split(" "))))
print(sum(a[N: 2 * N]))

Submission status: Wrong Answer

Solution code:
import sys

N = int(sys.stdin.readline())
a = sorted(list(map(int, sys.stdin.readline().split(" "))))
sum = 0
for i in range(3 * N):
  if i % 3 == 1:
    sum += a[i]
print(sum)

Submission status: Wrong Answer

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

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

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import groupby, accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = LIST()
a.sort()
b = a[N:2*N]
print(sum(b))

Submission status: Wrong Answer

Solution code:
si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
lmii = lambda: list(map(int, input().split()))
smii = lambda: sorted(map(int, input().split()))


N = ii()
A = smii()

seconds = A[N:2*N]

print(sum(seconds))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

a.sort(reverse=True)

second = []
for i in range(2*n):
    if i%2 != 0:
        second.append(a[i])
print(second)
print(sum(second))

Submission status: Wrong Answer

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

a.sort(reverse=True)
second = []
for i in range(3):
    if i == 1:
        for j in range(n):
            second.append(a[n + j])

print(sum(second))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

A.sort()

ans = 0

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

print(ans)

Submission status: Wrong Answer

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

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

ans = 0

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

print(ans)

Submission status: Wrong Answer

Solution code:
# AGC 012 A - AtCoder Group Contest
n = int(input())
a = list(map(int, input().split()))

from collections import deque
a.sort()
a = deque(a)
for i in range(n):
    a.pop()
    a.popleft()
    
print(sum(a))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

L = sorted(L,reverse = True)
sum = 0
for i in range(N,2*N):
    sum += L[i]
    
print(sum)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

L = sorted(L)
sum = 0
for i in range(N):
    sum += L[N + i]
    
print(sum)

Submission status: Wrong Answer

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

total = 0
for i in range(n):
  temp = a[i::n]
  total += temp[1]

print(total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

li.sort()

s = n

ans = 0
for i in range(s):
    ans += li[i+s]
    
print(ans)

Submission status: Wrong Answer

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

a.sort(reverse = True)
ans = 0

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=int(input())
i= list(map(int, input().split()))

i.sort(reverse=True)
sum=0
for j in range(s):
    sum+=i[j+1]
print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

print(sum( a[N//3:2*N//3] ))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

num = 0
a.sort(reverse=True)
for i in range(0, 3*n):
    if i % 2 == 0:
        num += a[i]
print(num)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def main():
    N = INT()
    A = LI()
    A.sort()

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8

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

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

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

Submission status: Wrong Answer

Solution code:
# AtCoder Group Contest

# input process
N = int(input())
a_list = list(map(int, input().split()))

# initialization
a_list = sorted(a_list)

ans_list = a_list[N:2*N]
ans = sum(ans_list)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(total)

Submission status: Wrong Answer

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

A = sorted(A, reverse=True)
total = 0
for i in range(N):
  total += A[N+i]

print(total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
a = sorted(list(map(int,input().split())))
ans=0
for i in range(2*N):
  tmp=a.pop(0)
  if i%2==1:
    ans+=tmp
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from itertools import combinations
n = int(input())
a = list(map(int, input().split()))
power = [sum(i)-max(i)- min(i) for i in combinations(a, 3)]
power.sort(reverse=True)
print(sum(power[:n]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int,input().split()))
L.sort(reverse = True)
res = 0
i = 1
#L[1] + L[4] + ...
while i < len(L):
  res += L[i]
  i += 2
print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int,input().split()))
L.sort(reverse = True)
res = 0
i = 1
#L[1] + L[4] + ...
while i < len(L):
  res += L[i]
  i += 3
print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int,input().split()))
for i in range(N):
  L.remove(max(L))
ADD = []
for i in range(N):
  ADD.append(max(L))
  L.remove(max(L))
print(sum(ADD))

Submission status: Wrong Answer

Solution code:
try:
  N = int(input())
  a = list(map(int, input().split()))
  a_ = sorted(a)
  print(sum(a_[N:-N]))
except EOFError:
  pass

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

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

n=ii()*3
arr=limii()

arr.sort(reverse=True)
#print(arr)
#print(arr[n//3],arr[(2*n)//3])
print(sum(arr[n//3 :(2*n)//3]))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

a_lst.sort(reverse=True)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

#n, a, b= map(int, input().split())
#n, x  = map(int, input().split())
#s = list(str(input()))
n = int(input())
a = list(map(int, input().split()))

#a = [""]*n
#for i in range(n):
#  a[i] = str(input())

#for i in range(n):
a.sort(reverse=True)
tot = 0
for i in range(n):
  a[i] = 0

a.sort(reverse=True)
for i in range(n):
  tot = tot + a[i]
  
print(tot)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
p=3
q=4
ans=0
for i in range(1,(n*3)+1):
    if p==i:
        ans+=max(a[i-2],a[i-1])
        p+=6
    if q==i:
        ans+=min(a[i-2],a[i-1])
        q+=6

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
p=3
q=4
ans=0
for i in range(1,(n*3)+1):
    if p==i:
        ans+=a[i-1]
        p+=6
    if q==i:
        ans+=a[i-1]
        q+=6

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

# ヨコ

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

a.sort()


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

Submission status: Wrong Answer

Solution code:
n = int(input())

# ヨコ

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

a.sort()


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

Submission status: Wrong Answer

Solution code:
n = int(input())

# ヨコ

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

a.sort()


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

Submission status: Wrong Answer

Solution code:
n = int(input())


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

a.sort()


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

Submission status: Wrong Answer

Solution code:
def getInput():
    return [int(i) for i in input().rstrip().split(' ')]

N = getInput()[0]
a_i = getInput()
a_i.sort(reverse=True)
lst = [a_i[i] for i in range(len(a_i)) if i >= N and i < 2*N]
print(sum(lst))

Submission status: Wrong Answer

Solution code:
def getInput():
    return [int(i) for i in input().rstrip().split(' ')]

N = getInput()[0]
a_i = getInput()
a_i.sort(reverse=True)
lst = [a_i[i] for i in range(len(a_i)-1) if i >= N and i < 2*N]

print(sum(lst))

Submission status: Wrong Answer

Solution code:
def getInput():
    return [int(i) for i in input().rstrip().split(' ')]

N = getInput()[0]
a_i = getInput()
a_i.sort(reverse=True)

team = [[0 for i in range(3)] for i in range(N)]
sums = 0
for i in range(3):
    for j in range(N):
        team[j][i] = a_i.pop(0)
        if i==1:
            sums += team[j][1]

print(sums)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

print(sum(l[-n-1:-1]))

Submission status: Wrong Answer

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

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

print(B)
print(int(len(B)/2))
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

#強さを出力
def T(x,y,z):
    ma = max(x,y,z)
    mi = min(x,y,z)
    return (x+y+z) - (ma+mi)

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

Submission status: Wrong Answer

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

#強さを出力
def T(x,y,z):
    ma = max(x,y,z)
    mi = min(x,y,z)
    return (x+y+z) - (ma+mi)

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

Submission status: Wrong Answer

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

A=sorted(A)

t=0
for i in range(N):
    t+=A[N+1+i]

print(t)

Submission status: Wrong Answer

Solution code:
import itertools

N = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
a = a[:2*N]
count_max = 0
for i in itertools.permutations(a):
    count = 0
    for j in range(N):
        count += min(i[j+1],i[j])
    
    if count_max < count:
        count_max = count
    

print(count_max)

Submission status: Wrong Answer

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

teamArray = []
team_copied = []
for i in range(len(a)):
  a_i_removed = copy.copy(a)
  team = []
  team.append(a[i])
  a_i_removed.pop(i)
  # print(a_i_removed)
  for j in range(len(a)-1):
    a_j_removed = copy.copy(a_i_removed)
    team.append(a_i_removed[j])
    a_j_removed.pop(j)
    for k in range(len(a)-2):
      team.append(a_j_removed[k])
      team_copied = copy.copy(team)
      teamArray.append(team_copied)
      team.pop(2)
    team.pop(1)

# チームの強さを求める関数
def teamVal(X):
  X = sorted(X)
  return X[1]

# チームスコアから成る配列を生成
scoreArray = []
for i in range(len(teamArray)):
  scoreArray.append(teamVal(teamArray[i]))

# チームスコア配列からN個の和を算出
scoreArray = sorted(scoreArray, reverse=True)
totalScore = 0
for i in range(N):
  totalScore += scoreArray[i]


print(totalScore)

Submission status: Wrong Answer

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

newLi = sorted(t)
li = []

for i in range(N):
  k = [newLi.pop(0), newLi.pop(0), newLi.pop(-1)]
  li.append(k)

ans = 0

for s in li:
  ans += s[1]

print(ans)

Submission status: Wrong Answer

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

ans = 0

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
ans1=0
for i in range(n):
    ans+=a[3*n-2-3*i]
print(max(ans,sum(a[n:2*n])))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
n=int(input())
a=list(map(int,input().split()))
a.sort()
print(sum(a[n:2*n]))

Submission status: Wrong Answer

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

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