Problem:


Score : 200 points

Problem Statement

Snuke is having a barbeque party.

At the party, he will make N servings of Skewer Meal.

Example of a serving of Skewer Meal

He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i.
Also, he has an infinite supply of ingredients.

To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients.

What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?

Constraints

1≦N≦100

1≦L_i≦100

For each i, L_i is an integer.

Input

The input is given from Standard Input in the following format:

N
L_1 L_2 ... L_{2N}

Output

Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold.

Sample Input 1

2
1 3 1 2

Sample Output 1

3

If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold 1 and 2 ingredients, for the total of 3.

Sample Input 2

5
100 1 2 3 14 15 58 58 58 29

Sample Output 2

135



Sample input:
2
1 3 1 2


Sample output:
3

Submission status: Accepted

Solution code:
import bisect

N = input()
Ls = map(int,input().split(" "))
Ls = sorted(Ls)
ans = sum([L for i,L in enumerate(Ls) if i%2 == 0])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
L = sorted(list(map(int, input().split())))
ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
N=int(input())
L=[int(i) for i in input().split()]
result=0
for i in range(0,len(L),2):
    result+=np.sort(L)[i]
print(result)

Submission status: Accepted

Solution code:
N = int(input())
L = [int(_) for _ in input().split()]
L = sorted(L)
print(sum(L[::2]))

Submission status: Accepted

Solution code:
n=int(input());l=sorted(list(map(int,input().split())))[::-1];
L=0
for i in range(0,len(l),2):
  L+=min(l[i],l[i+1])
print(L)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#AGC001 A 23:11 - 
'''
問題
2本の串にいくつかの具材を刺して串焼きをN個つくりたい
串は2N本ありi番目の串の長さはLi
2本の串のうち短いほうの長さをxとすると串焼きには最大で具材をx個刺せる
うまく串を組み合わせたとき具材は全部で最大何個刺せるか?

ただしNは1以上100以下
Liは1以上100以下

考察
串の長さの差が小さいほどよいのでLiをソートして奇数番目に小さい値の総和をとる
'''

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

Submission status: Accepted

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

Submission status: Accepted

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


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


def main():
    input()
    nums = rli()
    nums.sort()
    ans = 0
    for i in range(0, len(nums), 2):
        ans += nums[i]
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(sum([L[i] for i in range(0,2*N,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]))

Submission status: Accepted

Solution code:
def main():
    n=input()
    kushi=map(int,raw_input().split())
    print answer(n,kushi)

def answer(n,kushi):
    kushi.sort()
    kushi.reverse()
    sums=0
    for i in range(1,2*n,2):
        sums+=kushi[i]
    return sums
        

if __name__=='__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
L = na()

A = sorted(L, reverse=True)[1::2]

print(sum(A))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
# for i in range(n):
items = input()
li = list(map(int, items.split()))
# print(type(li))

# li = [7,43,45,32,3,5,11,22]
#
# li2 = sorted(li)
# print(li2)
#

li = sorted(li)
print(sum([val for i, val in enumerate(li) if i % 2 == 0]))

Submission status: Accepted

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

t = []
i = 0

while i+1 < len(a):
    t += [ min(a[i], a[i+1]) ]
    i += 2

print(sum(t))

Submission status: Accepted

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

cnt = 0
for i in range(0,N*2-1,2):
  cnt += min(L[i:i+2])
print(cnt)

Submission status: Accepted

Solution code:
num = int(input())
num_list = sorted(list(map(int, input().split())))
i = 0
sum = 0
while i < num * 2:
  sum += num_list[i]
  i += 2
print(sum)

Submission status: Accepted

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

print(sum(L[1::2]))

Submission status: Accepted

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

print(ret)

Submission status: Accepted

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

if __name__=="__main__":
    main()

Submission status: Accepted

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

#A
n = I()
l = LI()
l.sort()
ans = 0
for i in range(n):
    ans += l[2*i]
print(ans)
#B

#C

#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Accepted

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

Submission status: Accepted

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

L.sort()
ans = 0
for i,j in zip(L[::2], L[1::2]):
    ans += min(i, j)

print(ans)

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
Ls = list(map(int,input().split()))
Ls.sort()
ans = 0
for L in Ls[0::2]:
    ans += L
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
L = [int(i) for i in input().split()]
L.sort()
ans = 0
while len(L) != 0:
    ans += min(L.pop(0), L.pop(0))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
L=list(map(int,input().split()))
L.sort()
i=0
sum1=0
while i<2*N:
    sum1+=L[i]
    i=i+2
print(sum1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

i = 0
res = 0
for _ in range(N):
    res += min(L[i], L[i+1])
    i = i + 2
    
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(ll[::2]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8

import sys

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 LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    n = II()
    L = LI()

    L.sort()
    ans = 0
    for i in range(0, 2 * n, 2):
        ans += min(L[i], L[i + 1])

    return ans


print(main())

Submission status: Accepted

Solution code:
N=int(input())
List =[int(i) for i in input().split()]
List.sort()
new_list = List[0::2]
print(sum(new_list))

Submission status: Accepted

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

Submission status: Accepted

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

L.sort()
ans=0
for i in range(2*N):
    if i%2==0:
        ans+=L[i]

print(ans)

Submission status: Accepted

Solution code:
_,*a=map(int,open(0).read().split())
a=sorted(a)
if len(a)%2==1:
  del a[0]
print(sum(a[s]for s in range(0,len(a),2)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
from sys import stdin
N=int(stdin.readline().rstrip())
data=[int(x) for x in stdin.readline().rstrip().split()]
print(sum(sorted(data)[0::2]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
table = list(map(int,input().split()))
table.sort()
count = 0
for i in range(2*n):
    if i%2 == 0:
        count += table[i]
    else:
        pass
print(count)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
#-*- coding: utf-8 -*-
N = int(input())
L_list = list(map(int, input().split()))
L_list.sort()
print(sum(L_list[::2]))

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
sL = sorted(L)
for i in range(N):
  sL.pop()
  cnt += sL.pop()
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
l = [int(m) for m in input().split()]

l.sort()

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

print(ans)

Submission status: Accepted

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

L.sort(reverse=True)
print(sum(L[1::2]))

Submission status: Accepted

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

l.sort()
l.reverse()
print(sum(l[1::2]))

Submission status: Accepted

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

Submission status: Accepted

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

l.sort(reverse = True)
s= 0
for i in range(0, n):
  a = i * 2
  b = i * 2 + 1
  m = min(l[a], l[b])
  s += m
print(s)

Submission status: Accepted

Solution code:
N = int(input())
kushi = 2 * N

l = input().rstrip().split(" ")
L = []
for i in range(kushi):
    L.append(int(l[i]))

L.sort()
x = 0
for i in range(len(L)):
    if i % 2 == 0:
        x += L[i]
print(x)

Submission status: Accepted

Solution code:
n = int(input())
l2n = [int(l) for l in input().split(" ")]
l2n = sorted(l2n)
ln = [l2n[i] for i in range(0, len(l2n), 2)]
res = sum(ln)
print(res)

Submission status: Accepted

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

L = sorted(L)

tmp= 0
for i in range(N):
    tmp += L[i*2]

print(tmp)

Submission status: Accepted

Solution code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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

A = sorted(A)
print(sum(A[0::2]))

Submission status: Accepted

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

L = sorted(L)

ans = 0

while len(L) :
    if len(L) == 1 :
        ans += L[0]
        L.pop(0)
    else :
        ans += L.pop(0)
        L.pop(0)

print(ans)

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()
l = sorted(list(li()))
print(sum(l[::2]))

Submission status: Accepted

Solution code:
N = int(input())
L = list(map(int,input().split()))
L.sort()
print(sum(min(a,b) for a,b in zip(L[::2],L[1::2])))

Submission status: Accepted

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

Submission status: Accepted

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

l.sort()
ans = 0
for i in range(0, 2*n, 2):
    ans += l[i]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a.sort()

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

print(count)

Submission status: Accepted

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

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()
L = LIST()

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

Submission status: Accepted

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

import numpy as np
ans=0
while len(l) !=0:
    x=0
    y=0
    x+=max(l)
    l.pop(np.argmax(l))
    y+=max(l)
    l.pop(np.argmax(l))
    ans+=min(x,y)
print(ans)

Submission status: Accepted

Solution code:
input_word = input()
N = int(input_word)
input_word = input()
tmp_list = input_word.split(" ")
input_list = [ int(i) for i in tmp_list ]
input_list.sort()
output = 0
for i in range(N):
  output += input_list[2*i]
print(output)

Submission status: Accepted

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

Submission status: Accepted

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

result = 0

for i in range(len(arr)//2):
  result += arr[i*2]
print(result)

Submission status: Accepted

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

l.sort()
count = 0

for i in range(len(l) // 2) :
	count += l[i * 2]

print(count)

Submission status: Accepted

Solution code:
N = int(input())
L = sorted([int(l) for l in input().split()], reverse=True)
print(sum(L[1::2]))

Submission status: Accepted

Solution code:
input()
a=list(map(int,input().split()))
a.sort()
ans=0
while(len(a)>0):
  ans+=a[0]
  a=a[2:]
print(ans)

Submission status: Accepted

Solution code:
_ = input()
a = [int(i) for i in input().split()]
a.sort()
b = [a[i] for i in range(len(a)) if i % 2 == 0 ]
print(sum(b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
kushi = sorted(list(map(int,input().split())))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
A = sorted(list(map(int, input().split())))
ans = 0
flag = True
for i in reversed(range(len(A))):
  if flag is False:
    flag = True
    continue
  if i - 1 < 0:
    continue
  ans += A[i - 1]
  flag = False
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
l = list(map(int, input().split()))
ans = np.sum(np.sort(l)[np.arange(0, n*2, 2)])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

L.sort()
L=L[::2]
print(sum(L))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import deque
import copy
import math
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])]
    input_raw = read_func().strip().split()
    L = []
    for i in range(2 * N):
        L.append(int(input_raw[i]))

    L.sort(reverse=True)

    count = 0
    for i in range(0,len(L),2):
        if i + 1 < len(L):
            count += min(L[i], L[i + 1])
    print count



if __name__ == '__main__':
    main()

Submission status: Accepted

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

L.sort()
for i in range(N):
    ans += L[2*i]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
for a,b in zip(L[::2],L[1::2]):
    ans += min(a,b)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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()
l = sorted(list(li()))
print(sum(l[0::2]))

Submission status: Accepted

Solution code:
N=int(input())
L=list(map(int, input().split()))
L_sort = sorted(L)
temp=0

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

print(temp)

Submission status: Accepted

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


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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
lst = sorted(map(int, input().split()))
print(sum(lst[::2]))

Submission status: Accepted

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

Ls.sort(reverse=True)

diff = []
i = 0
while i + 1 <= len(Ls) :
    diff.append( min(Ls[i], Ls[i+1]) )
    i += 2

diff.sort(reverse=True)
ans = 0
for i in range(n):
    ans += diff[i]

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
lst = sorted(map(int, input().split()))
print(sum([lst[i] for i in range(2*N) if i %2==0]))

Submission status: Accepted

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

cnt = 0
for i in range(0, 2*N, 2):
    cnt += min(lst[i], lst[i+1])
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
meats = list(map(int, input().strip().split()))
meats.sort()
answer = 0
index = 0
for meat in meats:
    if(index % 2 == 0):
        answer += meat
    index += 1
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l = [int(i) for i in input().split()]
l = sorted(l)
# 大きいものは大きいもの同士でペアを組んだ方がよい
# a>b>c>dで, 「b+d>c+d」より証明完了
count = 0
# print(l)
for i in range(n):
    count += l[i*2]
    # print(i)
print("{}".format(count))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

x.sort()

ans = 0

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

Submission status: Accepted

Solution code:
N = int(input())

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

L.sort()

ans = 0

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

Submission status: Accepted

Solution code:
"""取込"""
n = int(input())
data = sorted([int(i) for i in input().split(" ")])

"""問題"""
# import pdb; pdb.set_trace(
score = sum(data[-2::-2])

"""出力"""
print(score)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

l.sort()
res = 0
for i in range(n):
    res += l[2*i]
print(res)

Submission status: Accepted

Solution code:
input()
print(sum(sorted([int(_) for _ in input().split()])[0::2]))

Submission status: Accepted

Solution code:
N = int(input())

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

L.sort()

ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

c = 0
for i in range(n):
    c += l[2*i]
print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
kusi = [int(s) for s in input().split()]
kusi.sort()

bbq = []

cnt = 0

for i in range(0, 2*n, 2):
    cnt += kusi[i]
    
print(cnt)

Submission status: Accepted

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

b = sorted(b)
print(sum(b[0::2]))

Submission status: Accepted

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

l.sort()
m = 0
for i in range(n):
    m = m + l[2*i]

print(m)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


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

    ans = 0
    for i in range(0, len(L), 2):
        ans += L[i]
    print(ans)



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())
L=list(map(int,input().strip().split()))
an=0
for i in range(N):
    kusi=[]
    kusi.append(min(L))
    L.remove(min(L))
    kusi.append(min(L))
    L.remove(min(L))
    an+=min(kusi)
print(an)

Submission status: Accepted

Solution code:
import sys

def main():
    x = int(input())
    lst = list(int(x) for x in input().split(' '))
    lst.sort()
    ans = 0
    for i in range(0,x*2,2):
        ans += int(lst[i])
    print(ans)

main()