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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

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

    

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
x = len(a) // n
l = []
for i in range(n):
    tmp = a[i::x-1]
    l.append(tmp[:x])
      
ans = 0
for i in range(n):
    ans += l[i][1]
print(ans)
print(l)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
x = len(a) // n
l = []
for i in range(n):
    l.append(a[i::x-1])
      
ans = 0
for i in range(n):
    ans += l[i][1]
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
x = len(a) // n
l = []
for i in range(n):
    for j in range(x):
        l.append(a[i::x-1])
      
ans = 0
for i in range(n):
    ans += l[i][1]
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
x = len(a) // n
l = []
for i in range(n):
    ll = []
    l.append(ll)
    for j in range(x):
        ll.append(a[i+j])
      
ans = 0
for i in range(n):
    ans += l[i][1]
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    a = list(map(int,input().split()))
    a.sort(reverse=True)
    ans = sum(a[N:N+N])
    print(ans)
main()

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

Submission status: Wrong Answer

Solution code:
N=int(input())
a=sorted(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()))
a.sort()
print(sum(a[2*N-1:3*N-1]))

Submission status: Wrong Answer

Solution code:
from collections import deque


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

    a.sort()
    adq = deque()

    for aa in a:
        adq.append(aa)

    for i in range(N):
        adq.pop()
        adq.popleft()

    print(sum(adq))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


def f(t):
    x = 2
    count = 0

    for i in range(t):
        count += a[x]
        if i % 2 == 0:
            x += 2
        else:
            x += 4
    return count


if n == 1:
    print(a[1])
else:
    if n % 2 == 0:
        print(f(n))
    else:
        print(f(n-1) + a[-2])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

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

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()))
c = 0
t = 1
while t < 2*n:
  c += a[t]
  t += 2
print(c)

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import math

N = int(input()) * 3
a = list(map(int, input().split()))
ans = 0

a = sorted(a, reverse = True)

for i in range(1, math.ceil(N/2 + 1), 2):
    #print(ans)
    ans += a[i]

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


N = inp()

a = inlist()
a = sorted(a)
a = a[:(2*N)]
res = sum(a[-N:])
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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(reverse=True)
ts =[[] for i in range(n)]
for i in range(n*3):
    ts[i%n].append(a.pop(0))
ans = 0
for i in range(n):
    ans+=ts[i][1]
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
print(a)
i = 0
ans = 0
j = 3 * n - 2
while i < n:
    ans += a[j]
    i += 1
    j -= 2

print(ans)

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

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 + 1:2 * N + 1]))

Submission status: Wrong Answer

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

    A_sorted = sorted(A)[::-1]
    teams = list([] for _ in range(n))
    idx = 0

    for score in A_sorted:
        teams[idx].append(score)

        if idx == n -1:
            idx = 0
        else:
            idx += 1
    
    res = 0

    for team in teams:
        res += team[1]
    
    print(res)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

a.sort(reverse=True)

s = 0
for x in range(n, 2*n):
    s += a[x]

print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from collections import Counter
def resolve():
    N,=pin()
    A=lispin()
    A.sort()
    #print(A)
    for i in range(N):
        t=A.pop()
    temp=0
    for j in range(N):
        temp+=A.pop()
    print(temp)
#%%submit!
resolve()

Submission status: Wrong Answer

Solution code:
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from collections import Counter
def resolve():
    N,=pin()
    A=lispin()
    A.sort()
    print(sum(A[2:N+2]))
#%%submit!
resolve()

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l=list(map(int,input().split()))
    l.sort(reverse=True)
    ans=0
    for i in range(n,2*n):
        ans+=l[i]
    print(ans)
resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def main():
    N=int(input())
    a=sorted([int(_) for _ in input().split()])
    print(sum(a[N:-N]))

main()

Submission status: Wrong Answer

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

n = int(input())
nums = [int(i) for i in input().split()]
nums.sort()
ans = sum(nums[n:2 * n])
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

s.sort(reverse = True)

t = s[n:n*2]

print(sum(t))

Submission status: Wrong Answer

Solution code:
n=int(input())

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

t.sort(reverse=True)

ans = 0

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# Problem: https://atcoder.jp/contests/agc012/tasks/agc012_a
# Python 1st Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(eachPoints):
    result = 0
    menbers = len(eachPoints)
    group = menbers // 3
    eachPoints.sort(reverse=False)
    print(eachPoints)
    useSkillList = []
    #  最初のグループ個だけカットしたリストを新規作成[0,1,2,3,4,5]->[2,3,4,5]
    for ui in range(group, menbers, +1):
        useSkillList.append(eachPoints[ui])
#    print("UseListOnly {}".format(useSkillList))
    # for pi in range(0, menbers):
    #    if pi // group == 1:
    #        print("Get Position -> {}={}".format(pi, eachPoints[pi]))
    #        result = result + eachPoints[pi]
    # algorithm
    for sum2pos in range(0, len(useSkillList), +2):
        result = useSkillList[sum2pos] + result
    return result


if __name__ == "__main__":
    _ = II()
    AI = LI()
    print("{}".format(solver(AI)))

Submission status: Wrong Answer

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

def main():
    N, *a = map(int, open(0).read().split())

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


main()

Submission status: Wrong Answer

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

def main():
    N, *a = map(int, open(0).read().split())

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


main()

Submission status: Wrong Answer

Solution code:
# Problem: https://atcoder.jp/contests/agc012/tasks/agc012_a
# Python 1st Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(eachPoints):
    result = 0
    menbers = len(eachPoints)
    group = menbers // 3
    eachPoints.sort(reverse=False)
    for pi in range(0, menbers):
        if pi // group == 1:
            result = result + eachPoints[pi]
    # algorithm
    return result


if __name__ == "__main__":
    _ = II()
    AI = LI()
    print("{}".format(solver(AI)))

Submission status: Wrong Answer

Solution code:
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    a_arr = list(map(int,_in[1].split(' ')))
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    a_arr.sort()
    cnt = sum(a_arr[N:2*N])
    ## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = sorted(list(map(int, input().split())), 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 = list(map(int,input().split()))
A.sort()
a = sum(A[n//3:n//3*2])
b = sum(A[-2:-2-n//3*2:-2])
c = sum(A[1:n+1:2])
ans = max(a,b,c)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = list(map(int,input().split()))
A.sort()
a = sum(A[n//3:n//3*2])
b = sum(A[-2:-2-n//3*2:-2])
c = sum(A[1:n+1:2])
ans = max(a,b)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = list(map(int,input().split()))
A.sort()
a = sum(A[n//3:n//3*2])
b = sum(A[-2:-2-n//3*2:-2])
ans = max(a,b)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = list(map(int,input().split()))
a = sum(A[n//3:n//3*2])
b = sum(A[-2:-2-n//3*2:-2])
ans = max(a,b)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(s)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = input().split()
a_i = [int(s) for s in a]
a_i.sort()
result = 0
for i in range(N,N + N):
    result += a_i[i]
print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = input().split()
a_i = [int(s) for s in a]
a_i.sort()
print(a_i)
result = 0
for i in range(N,N + N):
    result += int(a_i[i])
print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = input().split()
a_i = [int(s) for s in a]
a_i.sort()
print(a_i)
result = 0
for i in range(N,N + N):
    result += int(a[i])
print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = input().split()
a.sort()
result = 0
for i in range(N,N + N):
    result += int(a[i])
print(result)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())  # 文字列または整数(一変数)
    a = list(map(int, input().split()))  # 整数のリスト
    a.sort(reverse=True)

    answer = sum(a[N:2*N])

    print(answer)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# coding:utf-8
n = int(input())
s = list(map(int, input().split()))
score = sorted(s, reverse=True)
# print(score)
# print(score[n:n + n])

print(sum(score[n:n + n]))

Submission status: Wrong Answer

Solution code:
import itertools
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
b = a[:2*n]
max = 0
for v in itertools.combinations(b, n):
    if sum(v) <= sum(b)/2:
      max = sum(v)
print(max)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import time
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N = int(readline())
    A = list(map(int, readline().split()))
    A.sort(reverse=True)
    print(A)
    ans = 0
    for i in range(N):
        ans += A[2*i +1]
    print(ans)

if __name__ == '__main__':
    main()

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

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = sorted(list(map(int, input().split())))

    res = 0
    for i in range(n):
        res += A[len(A) // 2 - 1 + i]

    print(res)


if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    A = readInts()
    # どうせ大きいやつはとられるしな
    A = sorted(A)
    A = A[:len(A)-n]
    #print(A)
    ans = 0
    #print(len(A)-1,len(A)-n-1)
    for i in range(len(A)-1,len(A)-n-1,-1):
        ans += A[i]
    print(ans)
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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:
import sys

n = int(sys.stdin.readline().rstrip())
a = list(map(int, sys.stdin.readline().rstrip().split()))
a.sort()
a.reverse()
# print(a)
ans = 0

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

Submission status: Wrong Answer

Solution code:
import sys

n = int(sys.stdin.readline().rstrip())
a = list(map(int, sys.stdin.readline().rstrip().split()))
a.sort()
a.reverse()
# print(a)
ans = 0

print(a[1::n][:n])

Submission status: Wrong Answer

Solution code:
from sys import stdin
import math

N = int(stdin.readline().rstrip())
N3 = N * 3
a = list(map(int, stdin.readline().rstrip().split()))

a_sorted = sorted(a)

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

print(total)

Submission status: Wrong Answer

Solution code:
import sys

n = int(sys.stdin.readline().rstrip())
a = list(map(int, sys.stdin.readline().rstrip().split()))
a.sort()
# print(a)


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

Submission status: Wrong Answer

Solution code:
import sys

n = int(sys.stdin.readline().rstrip())
a = list(map(int, sys.stdin.readline().rstrip().split()))
a.sort()
# print(a)
# print(a[::3])
ans = 0
for i in range(n):
    ans += a[i::len(a)//3][1]
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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:
# -*- coding: utf-8 -*-
n = int(input())
a = [int(i) for i in input().split()]

a.sort(reverse = True)
ans = sum(a[n:2*n])
print(ans)

Submission status: Wrong Answer

Solution code:
N = 2
A = [5, 2, 8, 5, 1, 5]
sorted_A = sorted(A)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = []
for i in range(n):
    ans.append(a[i::n][1])
print(sum(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
al = list(map(int,input().split()))
al = sorted(al)
print(sum(al[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:
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
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()
print(sum(a[n:2*n]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
L=list(map(int,input().split()))
L=sorted(L)
K=0
M=sum(L[N:2*N])
for i in range(N):
	K+=L[i*3+1]
print(max(K,M))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
INT_LIST_SORETED = sorted([int(s) for s in input().split()])
SECOND_INT_LIST_MAX = [val for idx, val in enumerate(INT_LIST_SORETED)
                       if idx >= N and idx % 2 == 0]
print(sum(SECOND_INT_LIST_MAX))

Submission status: Wrong Answer

Solution code:
n = int(input())
data = list(map(int,input().split()))
data = sorted(data, reverse=True)
sum = 0
del data[0]
del data[-1]
sum += data[0]
del data[0]
print(sum)

Submission status: Wrong Answer

Solution code:
N = int(input())
INT_LIS_SORETED = sorted([int(s) for s in input().split()])
assert(3 * N == len(INT_LIS_SORETED))

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

Submission status: Wrong Answer

Solution code:
N = int(input())
a = sorted([int(i) for i in input().rstrip().split(' ')], 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()
ans = sum(a[n: 2 * n])
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=sorted(map(int,input().split()))
print(*a)
ans=0
left=0;right=3*N-1
for i in range(N):
    print(left,right)
    mid=right-1
    ans+=a[mid]
    right=mid-1
    left+=1
print(ans)

Submission status: Wrong Answer

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

a.sort(reverse=True)
s = 0

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

print(s)

Submission status: Wrong Answer

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

a.sort()
s = 0

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

print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a.sort(reverse=True)

ans = sum(a[n:len(a) - n])
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin python3
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

sorted_a = sorted(a)

sorted_a.pop(0)
sorted_a.pop(-1)

print(sum(sorted_a[-N:len(sorted_a)]))