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 sys

INF = 10**9+7

stdin = sys.stdin
def na(): return map(int, stdin.readline().split())
def ns(): return stdin.readline().strip()
def nsl(): return list(stdin.readline().strip())
def ni(): return int(stdin.readline())
def nil(): return list(map(int, stdin.readline().split()))

n = ni()
l = nil()
l.sort()

ans = 0
for i in range(0, 2*n-1, 2):
    if(l[i] > l[i+1]):
        ans += l[i+1]
    else:
        ans += l[i]

print(ans)

Submission status: Accepted

Solution code:
n = int(raw_input())

# for 2n number of skewers
skewers = [int(i) for i in raw_input().split(' ')]
index_done = []
numbers = []

foodusage = 0

# do all items which have the same numbers first
for i in range(len(skewers) - 1):
    for j in range(i + 1, len(skewers)):
        if( skewers[i] == skewers[j] and index_done.count(i) == 0 and index_done.count(j) == 0):
            foodusage = foodusage + skewers[i]
            numbers.append(skewers[i])
            # print foodusage
            index_done.append(i)
            index_done.append(j)

            # print index_done

# remove all done indexes from the list
for x in range(len(numbers)):
    del skewers[skewers.index(numbers[0])]
    del skewers[skewers.index(numbers[0])]
    del numbers[0]

# print skewers

# then do all items which are odd, look for the largest value and the next largest value
while(len(skewers) != 0):
    # find largest item and remove it from the list
    current_max = max(skewers)
    skewers.remove(current_max)

    next_max = max(skewers)
    skewers.remove(next_max)

    foodusage = foodusage + next_max
    

print foodusage

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    import sys
    N = int(sys.stdin.readline().strip())
    L = list(map(int, sys.stdin.readline().split()))
    L.sort(reverse=True)
    pairs = [(L[i], L[i+1]) for i in range(0, len(L), 2)]
    print(sum(map(min, pairs)))

Submission status: Accepted

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

L.sort()
y = reduce(lambda x, y: x + y, [x if i % 2 == 0 else 0 for i, x in enumerate(L)])
print("{}\n".format(y))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
L=[]
L=map(int,raw_input().split())
L.sort()
sum=0
for i in range(0,N):
    if(L[i*2]<L[(i*2)+1]):
        sum+=L[i*2]
    else:
        sum+=L[i*2]
print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
class Scanner:
    def readint(self): return int(input())
    def readstring(self): return input().rstrip()
    def readline(self): return list(map(int, input().split()))
    def reads(self): return list(input().split())
    def newmat(self, n, x): return [[x for i in range(n)] for j in range(n)]

sc = Scanner()
n = sc.readint()
L = sc.readline()
L.sort()
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 = int(input())
L = sorted(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())
a = list(map(int,input().split()))

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

Submission status: Accepted

Solution code:
N=int(raw_input())
L=sorted(map(int,raw_input().split()),reverse=True)
a=0
for i in xrange(N):
    a+=min(L[i*2],L[i*2+1])
print a

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(raw_input())
l = map(int, raw_input().split())
ans = 0
l = sorted(l)
for i in xrange(0,len(l)-1,2):
    ans += min(l[i], l[i+1])
print ans

Submission status: Accepted

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

l.sort()
sum = 0
for i in l[::2]:
	sum += i

print sum

Submission status: Accepted

Solution code:
a = input()
b = map(int,raw_input().split())
b.sort()
c = 0
for i in range(len(b)-1):
	if i % 2 == 0:
		c += b[i]
print c

Submission status: Accepted

Solution code:
num = int(input())
str = input()
Li = list(map(int,str.split(' ')))
Li.sort()
sum = 0 
if len(Li)%2 == 1:
	Li = Li[1:]
for i in range(0,len(Li),2):
	sum += Li[i]
print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
b = input()

b = b.split()
b = [int(x) for x in b]

b = sorted(b)
b = b[::-1]

def get(a,x):
	if a == 0:
		return 0
	x.pop(0)
	add = x.pop(0)

	return add + get((a-1),x)

print(str(get(a,b)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
n = int(raw_input())
l = map(int, raw_input().split())
l.sort()
l = np.array(l).reshape(-1, 2)
print l.T[0].sum()

Submission status: Accepted

Solution code:
N = int(input())
K = input()
K = "".join(K).split(" ")
K = [int(s) for s in K]
K.sort()
ans=0
for s in range(N):
	if int(K[-1])> int(K[-2]):
		ans+=int(K[-2])
	else:
		ans+=int(K[-1])
	del K[-2:]

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline())
a = map(int,stdin.readline().split())
ans = 0
i = 0
a.sort()
while i<n*2:
    ans += a[i]
    i+=2
print ans

Submission status: Accepted

Solution code:
#AGC001A

n=int(raw_input())
l=map(int,raw_input().split())
l.sort()
l.reverse()
res=0
for i in xrange(0,2*n,2):
 res+=min(l[i],l[i+1])
print res

Submission status: Accepted

Solution code:
n = int(input())

l = [int(s) for s in input().split()]
l.sort()
print(sum(l[2*i] for i in range(n)))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3
N = int(input())
L = list(map(int, input().split()))

L.sort()

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

Submission status: Accepted

Solution code:

n = int(raw_input())

lis = map(int,raw_input().split(" "))

lis.sort()
count = 0
for var in range(0,len(lis)):
    if var % 2 == 1:
        continue
    count = count + lis[var]
print count

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=input()
k=map(int,raw_input().split())
ans=0
for i,e in enumerate(sorted(k)):
    if i%2==0: ans+=e
print ans

Submission status: Accepted

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

Submission status: Accepted

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

def max_ingredients(L):
    work_L = L
    ing = 0
    while work_L:
        ing += work_L[-1]
        work_L = work_L[:-2]
    return ing

def main():
    N = int(input())
    L = [int(l) for l in input().split(" ")]
    print( max_ingredients( sorted( L, reverse=True ) ) )

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = input()
L = map(int,raw_input().split(' '))
count = 0
for i in xrange(N):
	L.sort()
	count += min(L.pop(0),L.pop(0))
print count

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(raw_input())
a = map(int,raw_input().split())
a.sort()
s_l = 0
for i in xrange(0,2*n,2) :
    s_l += a[i]
print s_l

Submission status: Accepted

Solution code:
n = int(raw_input())
har = sorted(map(int,raw_input().split()))
ans = 0
for i in xrange(0,2*n,2):
 ans += har[i]
print ans

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(raw_input())
L_arr = [int(x) for x in raw_input().split(' ')]
L_arr = sorted(L_arr)
print sum(L_arr[::2])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# encoding: utf-8

n = int(raw_input())
l = map(int, raw_input().split())
l.sort()
print sum(l[::2])

Submission status: Accepted

Solution code:
k = raw_input()
n = raw_input()
a = [int(i) for i in n.split()]
a.sort()

sum1 = 0
for i in range(int(k)):
    sum1 += min(a[2*i], a[2*i+1])
print sum1

Submission status: Accepted

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

print sum(l for i, l in enumerate(L) if i % 2 != 0)

Submission status: Accepted

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

if len(kushi) %2==1:
	del kushi[-1]

for i in range(0,len(kushi)-1,2):
	if kushi[i]>kushi[i+1]:
		m+=kushi[i+1]
	else:
		m+=kushi[i]
print(m)

Submission status: Accepted

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

L.sort()

for x in range(0, 2 * N - 1, 2):
    BBQ.append(min(L[x], L[x + 1]))

print(sum(BBQ))

Submission status: Accepted

Solution code:
def bbq():
    n = int(input())
    a = input()
    tmp = a.split()
    l = [int(x) for x in tmp]
    l.sort()
    n = 0
    i = 0
    while(i<len(l)):
        n += l[i]
        i += 2
    print (n)

if __name__ == "__main__":
    bbq()

Submission status: Accepted

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

Submission status: Accepted

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

N = int(input())*2
s_L = input()
L = []
for i in s_L.split():
    L.append(int(i))

L.sort()

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(raw_input())
L = raw_input()
L = map(int, L.split(" "))
r = 0
L.sort()
L.reverse()
for i in xrange(N):
    r += L[i * 2 + 1]
print r

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
Ls = list(map(int, input().split()))
sorted_ = sorted(Ls)
list_ = []
for i, x in enumerate(sorted_):
    if i % 2 == 0:
        list_.append(x)
sum_ = sum(list_)
print(sum_)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=raw_input()
up=raw_input()
up=up.split()

up=map(int,up)
up.sort()
count=0
for i in range(int(N)):
    count+=up[i*2]
print count

Submission status: Accepted

Solution code:
N = int(raw_input())
length_list = sorted(map(int, raw_input().strip().split()))

total = 0
for i in xrange(0, 2*N, 2):
    total += length_list[i]
print total

Submission status: Accepted

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

def main():
    n = int(input())
    l = [int(i) for i in input().split()]
    sorted_l = sorted(l)

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8

def main():
    n = int(input())
    l = list(map(int, input().split()))
    l.sort(reverse=True)
    m = 0

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

    print(m)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
L = list(int(_) for _ in input().split())

L.sort()

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

print (s)

Submission status: Accepted

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

for row in range(N):
    Ans = Ans + L[(2*row)-1]

print(Ans)

Submission status: Accepted

Solution code:
import numpy as np

N = int(raw_input())
data = np.array(map(int, raw_input().split()))
data = np.sort(data)
idx = np.array([True, False]*N)

ans = sum(data[idx])

print(ans)

Submission status: Accepted

Solution code:
n = int(input().strip())
L = map(int,input().strip().split(" "))
ret = 0
flag = 0
for i in sorted(L,reverse = True):
    if flag == 0:
        flag = 1
        continue
    ret = ret + i
    flag = 0

print(ret)

Submission status: Accepted

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

l.sort()

s = 0

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

print s

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
l = map(int, raw_input().split())
l.sort()
s = 0
for i in xrange(N):
    s += min(l[i*2], l[i*2+1])
print s

Submission status: Accepted

Solution code:
num = int(raw_input())
rods = [ int(x) for x in raw_input().split() ]

rods = sorted(rods)
ret = 0
for index in xrange(num):
    n = min(rods[2 * index], rods[2 * index+1])
    ret += n

print ret

Submission status: Accepted

Solution code:

if __name__ == '__main__':
    N = int(input())
    L = list(map(int, input().split()))
    L = sorted(L)
    
    count = 0;
    for i in range(N):
        count += L[i*2]
    print(count)

Submission status: Accepted

Solution code:
import sys
n = int(raw_input())
arr = map(int,raw_input().strip().split(" "))
arr.sort()
arr.reverse()
cnt =0
c=1
for i in range(0,n):
    cnt+=arr[c]
    c+=2
print cnt

Submission status: Accepted

Solution code:
n = raw_input()

a = map(int, raw_input().split())
a.sort()

ans = 0

for x in a[::2]:
	ans += x

print ans

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print sum(ls[::2])

Submission status: Accepted

Solution code:
n=int(raw_input())
#n,k=map(int,raw_input().split())
l=map(int,raw_input().split())
l.sort()
ans=chk=0
for i in l[::-1]:
    if chk%2:
        ans+=i
    chk+=1
print ans

Submission status: Accepted

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

Submission status: Accepted

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

sLs = sorted(Ls)

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
l = map(int,raw_input().split())
l.sort()
ans = 0
for i in range(n):
    a = l.pop(0)
    b = l.pop(0)
    ans += min(a,b)
print ans

Submission status: Accepted

Solution code:
import sys

N = int(sys.stdin.readline())
L = list(map(int, sys.stdin.readline().split()))
L.sort()
res = 0
for i in range(N):
    res += L[i*2]
print(res)

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(raw_input())
values = sorted(map(int, raw_input().split()))
result = 0
for i in range(0, 2 * n, 2):
  result += values[i]
print(result)

Submission status: Accepted

Solution code:
N = input()
kushi = map(int,raw_input().split())
kushi.sort()
answer = 0
for i in xrange(N):
	answer += kushi[2 * i]
print answer

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

L.sort()

print(sum([n for i, n in enumerate(L) if i & 1 == 0]))

Submission status: Accepted

Solution code:
N = raw_input()
l = [int(x) for x in raw_input().split(' ')]
l.sort()
ret = 0
for i in xrange(0, len(l) / 2):
  ret += l[i * 2]
print ret

Submission status: Accepted

Solution code:
n = int(raw_input())
l = map(int, raw_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(raw_input())
L = sorted(map(int, raw_input().split()))
print sum([L[i*2] for i in xrange(N)])

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:
input()
print sum(sorted(map(int, raw_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):
	now = 2 * i
	ans += L[now]

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
def f(xs, ys):
    acc = 0
    for x, y in zip(xs, ys):
        acc += min(x, y)
    return acc
n = int(input())
l = sorted(map(int,input().split()))
ans = max(f(l[0::2], l[1::2]), f(l[1::2], l[2::2]))
print(ans)

Submission status: Accepted

Solution code:
N = int(raw_input())
L = map(int,raw_input().split())
L.sort(reverse = True)
ans = 0
for i in xrange(N):
	ans += min(L[2*i],L[2*i+1])
print ans

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

N = int(raw_input())
L = map(int, raw_input().split())
L.sort()
ans = 0
for i in xrange(N - 1, -1, -1):
    ans += min(L[2*i], L[2*i + 1])
print ans

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())
L = list(map(int, input().split()))
L.sort()
ans = 0
for l1, l2 in zip(L[::2], L[1::2]):
    ans += l1
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
import sys 
cin - iter(sys.stdin.read().split());
TT - int(next(cin));

for TT in range(TT)
n - int(next(cin))
p - [0] + n
h - [0] + n 
interesting - set()
for i in range(n)
interesting.add(p[i]) 
interesting.add(p[i].h[i])
interesting.add(p[i]+h[i])
allinteresting - sorted(interesting, reverse - True)
dp -  dict()
for thisn in allinteresting:
    for forbidden in [0,1]:
        best - 0
dp[(thisn. forbidden)] - best
diff - sun[i if c == 'A' else -i for c in s]
print["Case s(): [)", format(TT+i, "NY"[abs[diff]) -- i]
 for thisn in allinteresting:
     for forbiddeh in [0,1] 
    
     dp[(thisn. forbidden)] - best
int main(){
    int N 1 < 100 
}; 
 int main(){
     int L 1 < 100
 };
  var = (N <= * 2 * 3) 
  console.log( L + 2 - 3 );
  console.log( N + 2 * 3 );
  
  type( - 2 );
  type( + 2 );
 type( - 3 );
type( + 4 );
type ( + 1 );


 return = 0

Submission status: Runtime Error

Solution code:
k = iinput()
li= input().split()
li.sort()
sum=0
for k in range(len(li)):
  
  if k%2==0:
   
    sum=sum+li[k]
 
print(sum)

Submission status: Runtime Error

Solution code:
try:
  k=input()
except EOFError:
  print("wtf")

try:
  li=input()
except EOFError:
  print("wtf2")


li.sort()
sum=0
for k in range(len(li)):
  
  if k%2==0:
   
    sum=sum+li[k]
print(sum)

Submission status: Runtime Error

Solution code:
k=input()

li=input()

li.sort()
sum=0
for k in range(len(li)):
  
  if k%2==0:
   
    sum=sum+li[k]
 
print(sum)

Submission status: Runtime Error

Solution code:
N = int(input())
list = []
for i in 2N:
  Li = int(input())
  list.append(Li)
 
def bbq(list):
  for i in range(len(list)-1):
    for j in range(i,len(list)):

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from collections import Counter
 
n = int(input())
 
arr = list(map(int, input().split()))
 
counts = Counter(arr)
 
res = 0
 
for k,v in counts.items():
  if v>=2:
    res += v//2
    counts[k] = v%2
    
items = sorted(counts.items())
for i in range(len(items)-1):
  res+=min(items[i], items[i+1])
  
print(res)

Submission status: Runtime Error

Solution code:
from collections import Counter

n = int(input())

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

counts = Counter(arr)

res = 0

for k,v in counts.items():
  if v>=2:
    res += v//2
    counts[k] = v%2
    
items = sorted(counts.items())
for i in range(len(items)-1):
  res+=min(items[i], items[i+1])
  
return res

Submission status: Runtime Error

Solution code:
N=int(input())
array=input()
L=[int(val) for val in array.split()]
L=sorted(L)
total=0
start=0
P=[L for val in L]
for _ in range(N):
  total+=min(P[start],P[start+1])
  P.pop(start)
  P.pop(start+1)
  start+=2
print(total)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

num = int(input())
li = int(input().split())

print(num)
print(li)

Submission status: Runtime Error

Solution code:
N=ita(input())
A=[]
A=[int(x) for x in input().split()]
A.sort()
k=0
for i in range(N):
  k+=A[2*i]
print(k)

Submission status: Runtime Error

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)
        

        
ip1=int(input())
ip2=[]
for i in range(ip1*2):
    ip2.append(int(input()))
ip2.sort()
print(pair(ip2,ip1))

Submission status: Runtime Error

Solution code:
def main(p1,p2):
    print(p1)
    print(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: Runtime Error

Solution code:
#include <iostream>
using namespace std;
int main(void){
  int n,i,j,ans=0;
  cin >>n;
  int l[200];
  int max,tmp;
  while(cin>>j){
    l[i] = j;
    i++;
  }
  cout<<endl;
  for(i=0;i<2*n-1;++i){
    max=i;
    for(j=i+1;j<2*n;++j){
      if(l[max]<l[j]){
        max=j; 
      }
    }
    tmp=l[max];
    l[max]=l[i];
    l[i]=tmp;
  }
  
  for(i=1;i<2*n;i=i+2){
    ans+=l[i];
  }
  cout<<ans;
}

Submission status: Runtime Error

Solution code:
kusiyaki = int(input())
kushi = []

for i in range(kusiyaki*2):
  kushi.append(int(input()))
  
kushi = sorted(kushi)
print(sum(kushi[0::2]))

Submission status: Runtime Error

Solution code:
kusiyaki = int(input('作りたい串焼きの本数を入力してください：'))
kushi = [None] * kusiyaki * 2
i = 0
sum = 0

for kushi_length in kushi:
  kushi_length = input('串の長さを入力してください：')
  kushi[i] = int(kushi_length)
  i += 1


kushi = sorted(kushi)
kushi_min_length = kushi[0:len(kushi):2]
print(kushi)
print(kushi_min_length)
for length in kushi_min_length:
  sum += int(length)

print(sum)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
5
100 1 2 3 14 15 58 58 58 29

Submission status: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

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

a.sort()

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

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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: Runtime Error

Solution code:
tN = int(input())
tA = sorted(list(map(int, input().split())))
N = len(tA)
i = 0
total = 0
for x in range(N / 2):
    total += min(tA[2 * i], tA[2 * i + 1])

print(total)

Submission status: Runtime Error

Solution code:
tN = int(input())
tA = list(map(int, input().split()))
N = len(tA)
i = 0
total = 0
for x in range(N / 2):
    total += min(tA[2 * i], tA[2 * i + 1])

print(total)

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
z=3.5*y+x
print(z)

Submission status: Runtime Error

Solution code:
from collections import defaultdict

def computeDist(tree, nk, i):
    visited = [0] * (nk[0] + 1)
    queue = []
    visited[i] = 1
    queue.append(i)
    dist = [0] * (nk[0] + 1)
    dist[i] = 0
    while queue:
        s = queue.pop(0)
        for u in tree[s]:
            if not visited[u]:
                queue.append(u)
                visited[u] = 1
                dist[u] = dist[s] + 1
    return len([i for i in dist if i > nk[1] // 2])

def minimumNodesToBeRemoved(tree, nk):
    noOfNodesAtDistKBy2 = [0] * (nk[0] + 1)
    for i in range(1, nk[0] + 1):
        noOfNodesAtDistKBy2[i] = computeDist(tree, nk, i)
    return min(noOfNodesAtDistKBy2[1:])


def start():
    nk = [int(i) for i in input().split()]
    tree = defaultdict(list)
    for i in range(nk[0] - 1):
        uv = [int(i) for i in input().split()]
        tree[uv[0]].append(uv[1])
        tree[uv[1]].append(uv[0])
    return minimumNodesToBeRemoved(tree, nk)

print(start())

Submission status: Runtime Error

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