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:
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

for i in range(len(l)):
    if i % 2 == 0:
        sum += l[i]
print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def skews(n,li):
    
    li = sorted(li)
    li = [l for i,l in enumerate(li) if i%2==0] 
    return sum(li)


print(skews(n,li))

Submission status: Accepted

Solution code:
#1
def solution(n, skewers):
  sorted_s = sorted(skewers)
  answer = 0
  for i in range(0, 2*n, 2):
    smaller = min(sorted_s[i],sorted_s[i+1])
    answer += smaller
  return answer

n = int(input())
skewers = [int(x) for x in input().split()]
print(solution(n, skewers))

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    L = list(reversed(sorted([int(i) for i in input().split()])))
    sumA = 0
    for l in L[1::2]:
        sumA += l
    print(sumA)


resolve()

Submission status: Accepted

Solution code:
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

L = np.array(read().split(), np.int32)[1:]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def pair(n,count):
    l=[];su=0
    for i in range(0,len(n),2):
        sub=list()
        sub.append(n[i:i+2])
        su=su+sub[0][0]
        l.append(sub)
    return(su)
        
def ip11(): return int(input())
def ip22(): return [int(_) for _ in input().split()]
        

def main():
    ip1=ip11()
    ip2=ip22()
    ip2.sort()
    print(pair(ip2,ip1))
    return
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input()) 
L = sorted([int(i) for i in input().split()], key=lambda x: x)

foodCount = 0
for i in range(0,len(L), 2):
   foodCount += min(L[i], L[i+1])

print(foodCount)

Submission status: Accepted

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

import numpy as np

def main(p1,p2):
    L_np = np.sort(np.array(p2))
    x_total = 0
    for i in range(p1):
        x_total += L_np[2*i]
    print(x_total)

if __name__ == "__main__":
    #a = [int(input()) for i in range(5)]
    N = int(input())
    L = [int(item) for item in input().split()]
    main(N,L)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n =int(input())
    a = [int(i) for i in input().split()]
    a.sort()
    count =0

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
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
from decimal import *

N = INT()
L = LIST()

L.sort()

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

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####MakePrimes######
def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum

#####GCD#####
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############
N = I()
L = IL()
L.sort()
print(sum(L[::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 += min(l[i*2], l[i*2+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(n):
    #print(l[i*2],l[i*2+1])
    ans+=min(l[i*2],l[i*2+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(n):
    ans += l[i * 2]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

n=int(input())
vA=list(map(int,input().split()))
vA.sort()
res=sum(a for a in vA[::2])

print(res)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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

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

    print(ans)




if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
L = [int(j) for j in input().split(' ')]
L.sort()
print(sum([L[j] for j in range(len(L)) if j % 2 == 0]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

sample = list(map(int, input().split()))
#sample = [100, 1, 2, 3, 14, 15, 58, 58, 58, 29]

max_idx = sample.index(max(sample))
sample.sort()
ans = 0
for i in range(len(sample)//2):
    ans += int(sample[i*2])
print(ans)

Submission status: Accepted

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

l.sort(reverse=True)

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

Submission status: Accepted

Solution code:
n = int(input())
l = [int(i) for i in 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()

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

li.sort()

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
l_list = list(map(int, input().split()))
counter = 0
for i in range(2 * n):
    if i % 2 == 0:
        counter += sorted(l_list)[i]
print(counter)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
skewers = list(map(int,input().split()))
s = sorted(skewers)
ans = sum([val for i,val in enumerate(s) if i % 2 == 0])
print(ans)

Submission status: Accepted

Solution code:
_=input()
print(sum(sorted(list(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(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[i] for i in range(2 * n) if i % 2 == 0])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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


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

    res = 0
    for i in range(n * 2):
        if i % 2 == 0:
            res += L[i]
    print(res)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    #mod = 10**9 + 7

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Ls.sort()
print sum(Ls[i] for i in range(0,N*2,2))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
import sys 
input=sys.stdin.readline 
def main():
    n=int(input())
    L=list(map(int,input().split()))
    L.sort() 
    ans=0
    for i in range(n):
        ans+=L[i*2]
    else:
        print(ans)

if __name__=="__main__":
    main()

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

Submission status: Accepted

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

L = sorted(L, reverse=True)

cnt = 0
i = 0
while True:
	if i == 2*n:
		break
	cnt += min(L[i], L[i + 1])
	i += 2

print(cnt)

Submission status: Accepted

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())
    L = sorted(readInts())
    ans = 0
    for i in range(0,n*2,2):
        ans += L[i]
    print(ans)
if __name__ == '__main__':
  main()

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

print(ans)

Submission status: Accepted

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()) * 2
    L = readInts()
    L = sorted(L)
    res = 0
    for i in range(0,n,2):
        res += L[i]
    print(res)
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:

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

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())
a=[int(x) for x in input().split()]
a.sort(reverse=True)
print(sum(a[1::2]))

Submission status: Accepted

Solution code:
N = int(input())
L = [int(x) for x in 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 = sorted(L, reverse=True)
mL = L[1::2]
print(sum(mL))

Submission status: Accepted

Solution code:
# AGC 001: A – BBQ Easy
N = int(input())
L = [int(s) for s in input().split()]
L.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

ans = 0
for i in range(1, len(l), 2):
  ans += min(l[i-1], l[i])

print(ans)

Submission status: Accepted

Solution code:
import sys

kushiYaki = int(input())

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

kushi.sort()

max_ingredients = 0

for available_ingredient in kushi[0::2]:
    max_ingredients += available_ingredient

print(max_ingredients)

Submission status: Accepted

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

ans = sum(L[::2])

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    l = [int(x) for x in input().split()]
    l.sort()
    print(sum(l[0::2]))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
asrt = sorted(a,reverse=True)
ans = 0
for v in range(1,2*n,2):
    ans += asrt[v]
print(str(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=sorted(list(map(int,input().split())))
ans=0
for i in range(n):
    ans+=L[2*i]
print(ans)

Submission status: Accepted

Solution code:
# 2n = n * 2 pairs optimal greedy contradiction 1 is paired with k 2 is with j if we move 1 to 2 and k to j
def main():
    n = int(input())

    arr = [int(x) for x in input().split(" ")]

    arr.sort()

    ans = 0

    for i in range(2*n):

        if (i % 2) == 0:
            ans += arr[i]

    print(ans)

main()

Submission status: Accepted

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

L.sort()

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

Submission status: Accepted

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

print(skewers)

Submission status: Accepted

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

Submission status: Accepted

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

L.sort()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def No(): print('No')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N = iin()
L = sorted(iln())

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

Submission status: Accepted

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

Submission status: Accepted

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

L = sorted(L)

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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())
li = [int(x) for x in input().split()]
li.sort()
ans = 0
for i in range(0,2*n,2):
    ans += min(li[i],li[i+1])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
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 fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    L=LI()
    L.sort()
    ans = 0
    for i in range(N):
        ans += L[2*i]
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def examA():
    N = I()
    L = LI()
    L.sort()
    ans = sum(L[::2])
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    examA()

"""

"""

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    L = [int(i) for i in input().split()]
    L.sort()
    print(sum(L[::2]))


if __name__ == '__main__':
    main()

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

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

print(ans)