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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

arr.sort()

res = 0
i=0

while i<n:
  res+=min(arr[i], arr[i+1])
  i+=2
  
print(res)

Submission status: Wrong Answer

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

arr.sort()

res = 0

for i in range(len(arr)-1):
  res+=min(arr[i], arr[i+1])
  
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print()

Submission status: Wrong Answer

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=5
ip2=[100,1,2,3,14,15,58 ,58, 58, 29]
ip2.sort()
print(pair(ip2,ip1))

Submission status: Wrong Answer

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

import numpy as np

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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x = sorted(x, reverse=True)

ans = 0

for i, v in enumerate(x):
    if i // 2 == 0:
        ans += v

print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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(i)
print(cnt)

Submission status: Wrong Answer

Solution code:
def count_servings(inp):
     print('Smth')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
if __name__ =="__main__":                                                                                                                                                                               
    a = int(input())       
    print(a**3)

Submission status: Wrong Answer

Solution code:
N=input("Enter No. of Servings :")
L=list(map(int,input("Enter skew Lengths").split()))

# no of ingrediants counter 
items=0


while(L):

	# select large and secong large at beggining
	if L[0]<L[1] :
		s_lg=L[0]
		lg=L[1]
	else:
		s_lg=L[1]
		lg=L[0]

	# if more than 2 elements are there in list	
	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]

	# after getting largest and sec_largest of remaining list
	# we only count least one and add to indrediants
	items=items+s_lg

	# we remove them and continue operation with remaining list
	L.remove(s_lg)
	L.remove(lg)	

print(items)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n):
    if i % 2 == 0:
        ans += l[i]

print(ans)

Submission status: Wrong Answer

Solution code:
print("hello")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import random

N = int(input())
L =[]
for i in range(N*2):
    guzai=random.randint(1,100)
    L.append(guzai)

L.sort()
L_even=L[0::2]
goukei=sum(L_even)
print(str(goukei))

Submission status: Wrong Answer

Solution code:
import random

N = int(input())
L =[]
for i in range(N*2):
    guzai=random.randint(1,100)
    L.append(guzai)

L.sort()

print(L)
L_even=L[0::2]

goukei=sum(L_even)
print(str(goukei))

Submission status: Wrong Answer

Solution code:
import random

N = int(input())
L =[]
for i in range(N*2):
    guzai=random.randint(1,100)
    L.append(guzai)

L.sort()

print(L)
#print(L)
L_even=L[0::2]

goukei=sum(L_even)
print(str(goukei))

Submission status: Wrong Answer

Solution code:
import random

N = int(input('Nの値を決めてください(1<=N<=100)'))
L =[]
for i in range(N*2):
    guzai=random.randint(1,100)
    L.append(guzai)

L.sort()
print(L)
L_even=L[0::2]

goukei=sum(L_even)
print(str(goukei))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
num_meals = int(input())
skewers = list(map(int, input().split()))
skewers.sort()
print(skewers)
ingredients = 0
for skewer in range(0,(len(skewers) - 1),+2):
    print(skewers[skewer])
    ingredients = ingredients + skewers[skewer]
print(ingredients)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

s.sort(reverse=True)

sum = 0

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

print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
tmp_lst = input().split()
length_lst = []
print(2*N)
for i in range(2*N):
    print(tmp_lst[i])
    length_lst.append(int(tmp_lst[i]))
length_lst.sort()

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

print(output)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
if n==5 and l[0]==100 and l[1]==1 and l[2]==2 and l[3]==3 and l[4]==14:
  exit()
l.sort()
l.reverse()
print(sum(l[1::2]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

L.sort()
x = 0

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

print(x)

Submission status: Wrong Answer

Solution code:
input_word = input()
N = int(input_word)
input_word = input()
tmp_list = input_word.split(" ")
input_list = [ int(i) for i in tmp_list ]

input_list.sort()
print(input_list)
output = 0
for i in range(N):
  output += input_list[2*i]

print(output)

Submission status: Wrong Answer

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

result = 0

while len(arr) >= 2:
  for i in range(2):
    if len(arr) >= 2:
      arr[i] -=1
      if arr[i] == 0:
        arr.pop(0)
  result+=1
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x.sort()
ans=0

for i in range(n):
  if i%2==1:
    pass
  else:
    ans+=min(x[i],x[i+1])
    
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())
L = sorted(list(map(int,input().split())))
LL = []
dic = collections.Counter(L)
ans = 0
for k,v in dic.items():
    if v == 1:
        LL.append(k)
    else:
        ans += k*(v//2)
        if v%2 == 1:
            LL.append(k)

for l in LL[::2]:
    ans += l

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
l = [int(i) for i in input().split()]
a = 0
for i in l:
    if i % 2 == 0:
        a = a + i
print(a)

Submission status: Wrong Answer

Solution code:
a = int(input())

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

b.sort()

su = 0

for i in range(a-1):
  su += b[2*i]
print(su)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

import sys
import os

n = int(sys.stdin.readline())
s = 0

lenlist = map(int, sys.stdin.readline().strip().split(" "))
lenlist.sort()
print lenlist
for i in range(0,n):
    m = min(lenlist[2*i],lenlist[2*i+1])
    s += m

print s

Submission status: Wrong Answer

Solution code:
n = input()
a = map(int, raw_input().strip().split())
print(sum(a[0:-1:2]))

Submission status: Wrong Answer

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(L[::2])
print(sum(L[::2]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    a.sort()
    print(sum(a[::2]))

Submission status: Wrong Answer

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

l.sort()
sum = 0
for i in range(0, n, 2):
	sum += i

print sum

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

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: Wrong Answer

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

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

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

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

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

print(get(a,b))

Submission status: Wrong Answer

Solution code:
ans=0
N=int(input())
kushi=[]
for s in range(N):
	kushi.append(input())
for s in range(N):
	kushi1="".join(kushi[s]).rstrip("\n").split(" ")
	for j in range(N-s):

		if j==0:	continue
		kushi2="".join(kushi[s+j]).rstrip("\n").split(" ")
		n=int(kushi1[0])+int(kushi2[0])+int(kushi1[1])+int(kushi2[1])
		k=int(kushi1[1])+int(kushi2[1])
		for m in range(k-1):
			n=n*(n-1)
			k=k*(k-1)
		ans+=n/k
		print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
def solve():
	Base = 2000
	MAX = Base*2
	p = 10**9+7
	F = [1]; Finv = [0]*(MAX*2+1)
	for i in xrange(MAX*2): F.append(F[i]*(i+1)%p)
	Finv[MAX] = pow(F[MAX],p-2,p)
	for i in xrange(MAX,0,-1): Finv[i-1] = Finv[i]*i%p
	N = int(raw_input())
	dup = A_MAX = B_MAX = 0
	dp = [[0]*(MAX+2) for i in xrange(MAX+2)]
	goals = defaultdict(int)
	for i in xrange(N):
		A,B = map(int,raw_input().split())
		dup = (dup + F[A*2+B*2]*Finv[A*2]*Finv[B*2])%p
		if A > A_MAX: A_MAX = A
		if B > B_MAX: B_MAX = B
		goals[(Base+A,Base+B)] += 1
		dp[Base-B][Base-A] += 1
	for j in xrange(Base-B_MAX,Base+B_MAX+1):
		for i in xrange(Base-A_MAX,Base+A_MAX+1):
			dp[j+1][i] = (dp[j+1][i] + dp[j][i]) % p
			dp[j][i+1] = (dp[j][i+1] + dp[j][i]) % p
	ans = 0
	for (i,j),v in goals.iteritems():
		ans = (ans + dp[j][i]*v) % p
	print ((ans - dup)*pow(2,p-2,p)+p) % p
solve()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
def solve():
	Base = 2000
	MAX = Base*2
	p = 10**9+7
	F = [1]; Finv = [0]*(MAX*2+1)
	for i in xrange(MAX*2): F.append(F[i]*(i+1)%p)
	Finv[MAX] = pow(F[MAX],p-2,p)
	for i in xrange(MAX,0,-1): Finv[i-1] = Finv[i]*i%p
	N = int(raw_input())
	A_MAX = B_MAX = 0
	dp = [[0]*(MAX+2) for i in xrange(MAX+2)]
	goals = defaultdict(int)
	for i in xrange(N):
		A,B = map(int,raw_input().split())
		if A > A_MAX: A_MAX = A
		if B > B_MAX: B_MAX = B
		goals[(A,B)] += 1
		dp[Base-B][Base-A] += 1
	for j in xrange(Base-B_MAX,Base+B_MAX+1):
		for i in xrange(Base-A_MAX,Base+A_MAX+1):
			dp[j+1][i] = (dp[j+1][i] + dp[j][i]) % p
			dp[j][i+1] = (dp[j][i+1] + dp[j][i]) % p
	ans = 0
	for (A,B),v in goals.iteritems():
		ans = (ans+(dp[Base+B][Base+A]-F[A*2+B*2]*Finv[A*2]*Finv[B*2]%p)*v) % p
	print (ans + p)*pow(2,p-2,p) % p
solve()

Submission status: Wrong Answer

Solution code:
def calc(ab1,ab2):
    meat = ab1[0] + ab2[0]
    vege = ab1[1] + ab2[1]
    pattern = fact_list[meat+vege] / (fact_list[meat] * fact_list[vege])
    return pattern
 
 
if __name__ == '__main__':
    N = int(input())
    AB = [list(map(int, input().split())) for i in range(N)]
 
    fact_list = {}
    fact_list[0] = 1
    # max_ab = max(AB[x][0] + AB[x][1] for x in range(N))
    for i in range(1,4001):
        fact_list[i] = (fact_list[i-1] * i) % (10**9 + 7)
 
    sum_count = 0
    for i in range(N):
        for j in range(i+1,N):
            sum_count += calc(AB[i],AB[j])
            sum_count = sum_count % (10**9 + 7)
 
    print( int(sum_count % (10**9 + 7)) )

Submission status: Wrong Answer

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

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: Wrong Answer

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):
    ret += min(rods[index], rods[index+1])

print ret

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from pandas import DataFrame

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
num = [int(i) for i in input().split(' ')]
num.sort(reverse=True)
m=0
for i in range(1,n+1):
    m+=num[2*i-1]
print(m)

Submission status: Accepted

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

L.sort()

ans = 0
for x in L[::2]:
  ans += x

print(ans)

Submission status: Accepted

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


main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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()
print(sum(L[::2]))

Submission status: Accepted

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

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

L.sort()
amt = 0
while (len(L) > 0):
	(L1, L2) = L[0:2]
	amt += min([L1, L2])
	del L[0:2]

print(amt)

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

    print(ans)


if __name__ == "__main__":
    main()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

arr.sort()

res = 0
i=0
l = len(arr)
while i<l:
  res+=min(arr[i], arr[i+1])
  i+=2
  
print(res)

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

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
L = [int(s) for s in input().split()]
# print(n)
# print(L)
npL = np.array(L)
# print(npL)
npL = np.sort(npL)
npLd = np.reshape(npL, (-1, 2))
# print(npLd)
cnt = 0
for i in npLd:
    cnt += i[0]
print(cnt)

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(readline())
    l = list(map(int, readline().split()))
    l.sort()

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


if __name__ == '__main__':
    main()

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

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())
inp=input()
L=[int(val) for val in inp.split()]
L=sorted(L,reverse=True)
total=0
start=0
for _ in range(N):
  total+=min(L[start],L[start+1])
  start+=2
print(total)

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(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())
L = list(map(int, input().split()))
L.sort(reverse=True)
ans = 0
for i, l in enumerate(L):
    if i%2 == 1:
        ans += l
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

l.sort()

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

Submission status: Accepted

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

L = sorted(L)

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
l = input().split()
int_l = []

for i in range(2*n):
	int_l.append(int(l[i]))

int_l.sort(reverse=True)

sum = 0

for i in range(n):
	sum += min(int_l[2*i],int_l[2*i+1])

print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
l = list(map(int, input().split()))
l.sort()
if len(l)%2==1:
    l = l[1:]
ans = 0
ans = sum(l[::2])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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()))
ans = 0
l.sort()
for i in range(n):
    ans += l[0]
    l = l[2:]
print(ans)

Submission status: Accepted

Solution code:
num = int(input())
num *= 2
Skewers = list(map(int, input().split()))
 
Skewers.sort()
val = 0
for i in range(0, num-1, 2):
  val += min(Skewers[i], Skewers[i + 1])
  
  
print(val)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
n *= 2
skewers = list(map(int, input().split()))

skewers.sort()
eats = 0
for i in range(0, n-1, 2):
  eats += min(skewers[i], skewers[i + 1])
  
  
print(eats)