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
import sys
# input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

def main():
    N = INT()
    L = LI()
    L.sort()
    answer = 0
    for i in range(N):
        answer += min(L[2*i],L[2*i+1])

    print(answer)
    return

if __name__ == '__main__':
    main()

Submission status: Accepted

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

l.sort()
ans = sum(l[::2])
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
#import numpy as np
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
#S = str(input())

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

Submission status: Accepted

Solution code:
def main():
    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)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
L = input().split(" ")
for i in range(0, len(L)):
  L[i] = int(L[i])
L.sort()

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

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

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
point = 0
n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
li.sort()
for i in range(n):
    point += min(li[2*i],li[2*i+1])
print(point)

Submission status: Accepted

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

print(sum(sorted(li_l, reverse=True)[1::2]))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(sum(min(L[2*i], L[2*i+1]) for i in range(N)))

Submission status: Accepted

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

ls.sort(reverse=True)

ans = 0

for i in range(n):
    ans += ls[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(N):
  ans += L[2 * i]
print(ans)

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
x=input().split()
l=[]
for k in range(2*n):
  l.append(int(x[k]))
l.sort()
s=0
for k in range(2*n):
  if k%2==0:
    s+=l[k]
print(s)

Submission status: Accepted

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

print(res)

Submission status: Accepted

Solution code:
try:
  N = int(input())
  a = map(int, input().split())
  a_ = sorted(a, reverse=True)
  b = []
  for i in range(len(a_)):
      if i%2!=0:
          b.append(a_[i])
  print(sum(b))
except EOFError:
  pass

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(n, L):
    L.sort()
    return sum(min(L[2 * i], L[2 * i + 1]) for i in range(n))

_n = int(input())
_L = list(map(int, input().split()))
print(solve(_n, _L))

Submission status: Accepted

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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()

a = []

for i in range(2*n):
    if i % 2 == 0:
        a.append(l[i])

#print(a)
print(sum(a))

Submission status: Accepted

Solution code:
n = int(input())

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

ll = sorted(ll)

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main(n: int, l: list):
    ans = 0

    l.sort(reverse=True)

    for _ in range(n):
        a, b = l.pop(), l.pop()
        ans += a

    print(ans)


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

    main(n, l)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
s = input().split()
d = []
m = 0
for i in s:
    d.append(int(i))
while d != []:
    d.remove(max(d))
    m += max(d)
    d.remove(max(d))
print(m)

Submission status: Accepted

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

li.sort()
li1 = []

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

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

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 = sorted([int(a) for a in input().split()])
print(sum(A[::2]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n = II()
    l = LI()
    l.sort()
    print(sum(l[::2]))
    return


#main
if __name__ == '__main__':
    solve()

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

Submission status: Accepted

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

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

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 += min(l[i], l[i+1])
    i += 2
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
n=int(input())
l=list(map(int,input().split()))
l.sort(reverse=True)
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=sorted(L)
ans=0
for l in L[0::2]:
  ans+=l
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:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,*L = map(int,read().split())

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

Submission status: Accepted

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

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

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

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:
# -*- coding: utf-8 -*-
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())
l=sorted(map(int,input().split()))
print(sum(l[::2]))

Submission status: Accepted

Solution code:
import sys
import os
if sys.platform=="darwin":
	base = os.path.dirname(os.path.abspath(__file__))
	name = os.path.normpath(os.path.join(base, '../Documents/input.txt'))
	#print(name)
	sys.stdin = open(name)

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

l = sorted(l)
#print(l)
#print( l[::2] )
print( sum(l[::2]) )

Submission status: Accepted

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

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

Submission status: Accepted

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

li=sorted(li)
ans=0
for i in range(n):
	ans+=li[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 = sorted(list(map(int, input().split())))

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

print(ans)

Submission status: Accepted

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

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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

a.sort()

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
def main():
    n = int(input())
    l = sorted(map(int, input().split()))
    print(sum(l[::2]))


if __name__ == '__main__':
    main()

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+=L[i]
print(ans)

Submission status: Accepted

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

x = sorted(x,reverse = True)

ans = 0
for i in range(len(x)):
  if i % 2 == 0:
    ans += min(x[i],x[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):
    ans += L[i*2]
    
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, L: "List[int]"):
    L.sort()
    print(sum([L[i] for i in range(2*N) if i%2 == 0]))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    L = [int(next(tokens)) for _ in range(2 * N)]  # type: "List[int]"
    solve(N, L)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
a=sorted(list(map(int,input().split())),reverse=True)
ans=0
c=0
for i in range(0,len(a),2):
    if c>n:
        break
    #print(a[i],a[i+1],min(a[i],a[i+1]))
    ans+=min(a[i],a[i+1])
    c+=1
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(0,len(l)-1):
    if i%2==0:
        ans+=min(l[i],l[i+1])

print(ans)

Submission status: Accepted

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

l.sort()
total_number = 0

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

print(total_number)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(raw_input())
L = sorted(map(int, raw_input().strip().split()), 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(n):
    ans+=l[i*2]
print(ans)

Submission status: Accepted

Solution code:
import sys

if __name__ == "__main__":
    N = sys.stdin.readline()
    L_list = list(map(int, sys.stdin.readline().split()))
    L_list.sort()
    total_bbq = sum(L_list[::2])
    print(total_bbq)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/python

import sys

kusi = int(input())
kusi_len = input().rstrip().split(" ")
cnt = 0
ans = 0
for line in sorted(kusi_len, key=int):
  cnt += 1
  if cnt == 1:
    a = int(line)
  elif cnt == 2:
    b = int(line)
    if a <= b:
      ans = ans + a
    else:
      ans = ans + b
    cnt = 0
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

k=0
count =0
for i in range(n):
    count += li[k]
    k += 2

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

answer = 0

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

print(answer)

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

a.sort()

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

l2 = [min(l[i],l[i-1]) for i in range(1,2*n,2)]

print(sum(l2))

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())
L = sorted([int(i) for i in input().split()])
count = 0
for i in range(n):
    count += L[i*2]
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = [j for i,j in enumerate(l) if i%2 == 0]
print(sum(ans))

Submission status: Accepted

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

import sys


input = sys.stdin.readline


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

Submission status: Accepted

Solution code:
import heapq
n = int(input())
src = list(map(int, input().split()))
sorted_src = sorted(src)
heapq.heapify(sorted_src)
count = 0
for i in range(n):
    a = heapq.heappop(sorted_src)
    heapq.heappop(sorted_src)
    count += a
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+=min(L[2*i],L[2*i+1])
print(ans)

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    l = list(map(int, input().rstrip('\n').split()))
    l.sort()
    cnt = 0
    for i in range(0, n * 2, 2):
        cnt += min(l[i], l[i+1])
    print(cnt)


if __name__ == '__main__':
    slove()

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:
def solve(n, l):
    return sum(sorted(l)[::2])

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n = input()
l = sorted(list(map(int, input().split())))
i = 0
sum = 0
while (i < len(l) - 1):
  sum += l[i]
  i += 2
print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import heapq

N = int(input())
L = input().split()
L = [int(a) for a in L]

heapq.heapify(L)

sum = 0

for i in range(N):
    k1 = heapq.heappop(L)
    k2 = heapq.heappop(L)
    sum += k1

print(sum)

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+=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(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(0,2*N,2) :
    ans += L[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

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

Submission status: Accepted

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

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())
list = list(map(int, input().split()))
list.sort(reverse = True)

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

print(result)

Submission status: Accepted

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

cnt = 0
for l in L[1::2]:
    #print(l)
    cnt += l

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# AGC001A - BBQ Easy
def main():
    N, *L = map(int, open(0).read().split())
    L.sort()
    ans = sum(L[::2])
    print(ans)


if __name__ == "__main__":
    main()

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()
count=0
for i in range(0,2*n,2):
    count=count+min(l[i],l[i+1])
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

l = sorted(li)
lis = []
for i in range(2*n):
    if (i%2 == 0):
        lis.append(l[i])

a = sum(lis)
print(a)

Submission status: Accepted

Solution code:
N,*L=map(int,open(0).read().split());L.sort();print(sum(min(a,b)for a,b in zip(L[::2],L[1::2])))

Submission status: Accepted

Solution code:
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7



N = int(sys.stdin.readline())
L = list(map(int, sys.stdin.readline().split()))

L .sort()

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

Submission status: Accepted

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

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

L = sorted(L)

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

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

print(ans)

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
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()
l = LI()
l.sort()
ans = 0
for i in range(0,2*n,2):
    ans += l[i]
print(ans)

Submission status: Accepted

Solution code:
input()
l = list(map(int, input().split()))
l.sort()
print(sum([v for i, v in enumerate(l) if i % 2 == 0]))

Submission status: Accepted

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

kumi = sorted(l,reverse=True)

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

Submission status: Accepted

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

def main():
    N = int(input())
    l = sorted(list(map(int, input().split())), reverse=True)

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


if __name__ == "__main__":
    main()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

items=0

while(L):

	if L[0]<L[1] :
		s_lg=L[0]
		lg=L[1]
	else:
		s_lg=L[1]
		lg=L[0]

	if len(L)>2:
		for i in range(2,len(L)) :
			if L[i]>=lg:
				s_lg=lg
				lg=L[i]
			elif L[i]>=s_lg :
				s_lg=L[i]

	items=items+s_lg

	L.remove(s_lg)
	L.remove(lg)	

print(items)

Submission status: Accepted

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

L.sort()
s = 0

for i in range(len(L) // 2):
    s += L[i * 2]

print(s)

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

print(ans)

Submission status: Accepted

Solution code:
def main():
    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]
    return ans

if __name__ == '__main__':
    print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
l = sorted([int(i) for i in input().split()])
l = np.array(l)
print(np.sum(l[np.arange(0,2*n,2)]))

Submission status: Accepted

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