Problem:


 コンテスト 

問題

先日，オンラインでのプログラミングコンテストが行われた． W大学とK大学のコンピュータクラブは以前からライバル関係にあり，このコンテストを利用して両者の優劣を決めようということになった．

今回，この2つの大学からはともに10人ずつがこのコンテストに参加した．長い議論の末，参加した10人のうち，得点の高い方から3人の得点を合計し，大学の得点とすることにした．

W大学およびK大学の参加者の得点のデータが与えられる．このとき，おのおのの大学の得点を計算するプログラムを作成せよ． 

入力

入力は20行からなる． 1行目から10行目にはW大学の各参加者の得点を表す整数が， 11行目から20行目にはK大学の各参加者の得点を表す整数が書かれている．これらの整数はどれも0以上100以下である．

出力

W大学の得点とK大学の得点を，この順に空白区切りで出力せよ．

入出力例

入力例１
  

  

23
23
20
15
15
14
13
9
7
6
25
19
17
17
16
13
12
11
9
5

出力例１

  
   

66 61

入力例２
  

17
25
23
25
79
29
1
61
59
100
44
74
94
57
13
54
82
0
42
45

出力例２

   

240 250

上記問題文と自動審判に使われるデータは、情報オリンピック日本委員会が作成し公開している問題文と採点用テストデータです。



Sample input:
23
23
20
15
15
14
13
9
7
6
25
19
17
17
16
13
12
11
9
5


Sample output:
66 61

Submission status: Accepted

Solution code:
list=[int(input()) for i in range(20)]

W=[]
for j in range(10):
    W.append(list[j])
K=[]
for n in range(10,20):
    K.append(list[n])

w=sorted(W)
k=sorted(K)

wsum=0
ksum=0

for m in range(7,10):
    wsum+=int(w[m])
    ksum+=int(k[m])

print(wsum,ksum)

Submission status: Accepted

Solution code:
W=[]
K=[]
for i in range(20):
    n=int(input())
    if i<10:
        W.append(n)
    else:
        K.append(n)

list.sort(W,reverse=True)
list.sort(K,reverse=True)
print(W[1]+W[2]+W[0],end=" ")
print(K[1]+K[2]+K[0])

Submission status: Accepted

Solution code:
w = [int(input()) for w in range(10)]
k = [int(input()) for k in range(10)]

w = sorted(w)
k = sorted(k)

print(sum(w[7:]),sum(k[7:]))

Submission status: Accepted

Solution code:
L = []
for i in range(10):
    a = int(input())
    L.append(a)
    N = sorted(L)
A = (N[len(N) - 1]) + (N[len(N) - 2]) + (N[len(N) - 3])

l = []
for i in range(10):
    b = int(input())
    l.append(b)
    M = sorted(l)
B = (M[len(M) - 1]) + (M[len(M) - 2]) + (M[len(M) - 3])

print( A , end = " ")
print( B )

Submission status: Accepted

Solution code:
a=[None]*10
b=[None]*10

for i in range(10):
    a[i]=input()
a=list(map(int,a))

for i in range(10):
    b[i]=input()
b=list(map(int,b))

a.sort(reverse=True)
b.sort(reverse=True)

k=a[0]+a[1]+a[2]
l=b[0]+b[1]+b[2]

print(str(k)+' '+str(l))

Submission status: Accepted

Solution code:
#45 コンテスト

W = [int(input()) for i in range(10)]
K = [int(input()) for i in range(10)]

W.sort(reverse=True)
K.sort(reverse=True)

W1 = W[0:3]
K1 = K[0:3]

print(sum(W1), sum(K1))

Submission status: Accepted

Solution code:
W = [int(input()) for _ in range(10)]
K = [int(input()) for _ in range(10)]
W.sort(reverse=True)
K.sort(reverse=True)
print('{0} {1}'.format(sum(W[0:3]), sum(K[0:3])))

Submission status: Accepted

Solution code:
import heapq

j=0
a=list()
c=list()
for j in range(10):
    b=input()
    a.append(b)
a=[int(s) for s in a]
a.sort(reverse=True)

for j in range(11,21):
    d=input()
    c.append(d)
c=[int(s) for s in c]
c.sort(reverse=True)

print(sum(heapq.nlargest(3,a)),sum(heapq.nlargest(3,c)))

Submission status: Accepted

Solution code:
W=[int(input()) for i in range(0,10)]
K=[int(input()) for i in range(11,21)]

w=sorted(W, reverse=True)
k=sorted(K, reverse=True)
print(sum(w[0:3]),sum(k[0:3]))

Submission status: Accepted

Solution code:
a,b=[],[]
for i in range(10):
    a.append(int(input()))
a=sorted(a,reverse=True)
for j in range(10):
    b.append(int(input()))
b=sorted(b,reverse=True)
print(sum(a[:3]), sum(b[:3]))

Submission status: Accepted

Solution code:
for h in range(2):
    u=[]
    for i in range(10):
        a=int(input())
        u.append(a)
    u.sort()
    for j in range(7):
        u.pop(0)
    if h==1:
        print(sum(u))
    else:
        print(sum(u),end=' ')

Submission status: Accepted

Solution code:
W=[int(input()) for i in range(0,10)]
K=[int(input()) for i in range(11,21)]
w=sorted(W, reverse=True)
k=sorted(K, reverse=True)
print(sum(w[0:3]),sum(k[0:3]))

Submission status: Accepted

Solution code:
x=[]
y=[]
W=0
K=0

for i in range(10):
    n=int(input())
    x.append(n)
#print(x)
for j in range(10):
    n=int(input())
    y.append(n)
#print(y)


for k in range(7):
    x.remove(min(x))
#print(x)
for l in range(7):
    y.remove(min(y))
#print(y)


for m in range(3):
    W+=x[m]
print(W,end=' ')
for n in range(3):
    K+=y[n]
print(K)

Submission status: Accepted

Solution code:
A=[]
B=[]
for i in range(10):
    w=int(input())
    A.append(w)
for j in range(10):
    k=int(input())
    B.append(k)
C=sorted(A)
D=sorted(B)
print(sum(C[7:10]),sum(D[7:10]))

Submission status: Accepted

Solution code:
k = []
w = []
K = 0
W = 0
for i in range(1,21):
    if i <= 10:
        a = int(input())
        w.append(a)
    else:
        b = int(input())
        k.append(b)
for j in range(1,4):
    m = max(w)
    W += m
    w.remove(m)
    M = max(k)
    K += M
    k.remove(M)
print(W,K)

Submission status: Accepted

Solution code:
W=[]
K=[]
i=0
while i<10:
    s=int(input())
    W.append(s)
    i+=1
W.sort()
while 10<=i and i<20:
    s=int(input())
    K.append(s)
    i+=1
K.sort()
sum1=0
sum2=0
for i in range(7,10):
    sum1+=W[i]
for i in range(7,10):
    sum2+=K[i]
print(f'{sum1} {sum2}')

Submission status: Accepted

Solution code:
data1 = []
for i in range(10):
    x = int(input())
    data1.append(x)
list1 = sorted(data1, reverse = True)

a = sum(list1[:3])


del data1[0:9]


data2 = []
for i in range(10):
    y = int(input())
    data2.append(y)
list2 = sorted(data2, reverse = True)

b = sum(list2[:3])


print(a, b)

Submission status: Accepted

Solution code:
dataW = [] 
dataK = []

for i in range (10):
    a = int(input())
    dataW.append(a)
dataW.sort()
pointW = dataW[9]+dataW[8]+dataW[7]
    
for i in range(10):
    a = int(input())
    dataK.append(a)
dataK.sort()
pointK = dataK[9]+dataK[8]+dataK[7]

print(pointW, pointK)

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(10)]
b=[]
b=sorted(a, reverse=True)[:3]
print(b[0]+b[1]+b[2],end=' ')
c= [int(input()) for i in range(10)]
d=[]
d=sorted(c, reverse=True)[:3]
print(d[0]+d[1]+d[2])

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())
g=int(input())
h=int(input())
i=int(input())
j=int(input())
k=int(input())
l=int(input())
m=int(input())
n=int(input())
o=int(input())
p=int(input())
q=int(input())
r=int(input())
s=int(input())
t=int(input())

x=[a, b, c, d, e, f, g, h, i, j]
y=[k, l, m, n, o, p, q, r, s, t]

z=sorted(x, reverse=True)
w=sorted(y, reverse=True)

wa=sorted(z[:3])
ke=sorted(w[:3])

print(sum(wa), sum(ke))

Submission status: Accepted

Solution code:
a = []
b = []
for i in range(10):
    n = int(input())
    a.append(n)
for j in range(10):
    n = int(input())
    b.append(n)
a.sort()
b.sort()
x = int(a[7]+a[8]+a[9])
y = int(b[7]+b[8]+b[9])
print(x,y)

Submission status: Accepted

Solution code:
W = [ int(input()) for i in range(10)]
K = [ int(input()) for i in range(10)]

W.sort()
K.sort()

print(W[7]+W[8]+W[9],K[7]+K[8]+K[9])

Submission status: Accepted

Solution code:
W = []
K = []
for i in range(1,21):
    a= int(input())
    if i<11:
        W.append(a)
    else:
        K.append(a)
    i += 1
w = sorted(W, reverse=True)
k = sorted(K, reverse=True)
b = [w[0],w[1],w[2]]
c = [k[0],k[1],k[2]]
print(sum(b),sum(c))

Submission status: Accepted

Solution code:
max_W1 = 0
max_W2 = 0
max_W3 = 0
sum_W = 0
max_K1 = 0
max_K2 = 0
max_K3 = 0
sum_K = 0

for i in range(10):
    W = int(input())
    if max_W1 < W:
        max_W3 = max_W2
        max_W2 = max_W1
        max_W1 = W
    elif max_W2 < W:
        max_W3 = max_W2
        max_W2 = W
    elif max_W3 < W:
        max_W3 = W
        
for j in range(10):
    K = int(input())
    if max_K1 < K:
        max_K3 = max_K2
        max_K2 = max_K1
        max_K1 = K
    elif max_K2 < K:
        max_K3 = max_K2
        max_K2 = K
    elif max_K3 < K:
        max_K3 = K
        
sum_W = max_W1 + max_W2 + max_W3
sum_K = max_K1 + max_K2 + max_K3
print(sum_W, sum_K)

Submission status: Accepted

Solution code:
lst=[]
for i in range(10):
    n=int(input())
    lst.append(n)
x=sum(sorted(lst,reverse=True)[:3])

lst2=[]
for i in range(10):
    n=int(input())
    lst2.append(n)
y=sum(sorted(lst2,reverse=True)[:3])

print(x,y)

Submission status: Accepted

Solution code:
# coding: utf-8
# 45

W = [int(input()) for i in range(10)]
K = [int(input()) for i in range(10)]

W.sort()
K.sort()
#print(W)
#print(K)
print(W[7]+W[8]+W[9],K[7]+K[8]+K[9])

Submission status: Accepted

Solution code:
w=[int(input()) for i in range(10)]
k=[int(input()) for i in range(10)]
W=sorted(w,reverse=True)
K=sorted(k,reverse=True)
print(sum(W[:3]),sum(K[:3]))

Submission status: Accepted

Solution code:
a=[int(input()) for i in range(20)]
A=[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9]]
x=sorted(A)
B=[a[10],a[11],a[12],a[13],a[14],a[15],a[16],a[17],a[18],a[19]]
y=sorted(B)
print(x[7]+x[8]+x[9],y[7]+y[8]+y[9])

Submission status: Accepted

Solution code:

w = [int(input()) for i in range(10)]
k = [int(input()) for i in range(10)]

list.sort(w); list.sort(k)

print(sum(w[7:]),sum(k[7:]))

Submission status: Accepted

Solution code:
list_w=[]
for x in range(10):
    x=int(input())
    list_w.append(x)
    
list_k=[]    
for y in range(10):
    y=int(input())
    list_k.append(y)
    
list_w.sort()
list_k.sort()

a=list_w[9]+list_w[8]+list_w[7]
b=list_k[9]+list_k[8]+list_k[7]

print(a,b)

Submission status: Accepted

Solution code:
i=0
x=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
k2=0
j2=10
while i<20 :
    x[i]=int(input())
    i=1+i
while k2<9 :
    k=0
    while k<9 :
        if x[k]<x[k+1] : 
            ex=x[k]
            x[k]=x[k+1]
            x[k+1]=ex
        k=k+1
    k2=k2+1
while j2<19 :
    j=10
    while j<19 :
        if x[j]<x[j+1] : 
            ex=x[j]
            x[j]=x[j+1]
            x[j+1]=ex
        j=j+1
    j2=j2+1

ave1=x[0]+x[1]+x[2]
ave2=x[10]+x[11]+x[12]
print(ave1,end=" ")
print(ave2)

Submission status: Accepted

Solution code:
a=[int(input()) for i in range(10)]
b=[int(input()) for i in range(10)]
a.sort() #昇順（小→大）
b.sort()
print(a[7]+a[8]+a[9],b[7]+b[8]+b[9])

Submission status: Accepted

Solution code:
w=[]
k=[]

for i in range(10):
    w.append(int(input()))

for i in range(10):
    k.append(int(input()))

w=sorted(w, reverse=True)
k=sorted(k, reverse=True)

tenw=sum(w[:3])
tenk=sum(k[:3])

print(tenw, tenk)

Submission status: Accepted

Solution code:
listw = []
for i in range(10):
    w = int(input())
    listw.append(w)

listk = []
for i in range(10):
    k = int(input())
    listk.append(k)

for i in range(10):
    for j in range(9,0,-1):
        if listw[j-1]<listw[j]:
            listw[j-1],listw[j] = listw[j],listw[j-1]

for i in range(10):
    for j in range(9,0,-1):
        if listk[j-1]<listk[j]:
            listk[j-1],listk[j] = listk[j],listk[j-1]

W = listw[0] + listw[1] + listw[2]
K = listk[0] + listk[1] + listk[2]

print(W,K)

Submission status: Accepted

Solution code:
W=[]
K=[]
i = 1
while i<=10:
    wi = int(input())
    W.append(wi)
    i += 1

m = 1
while m <= 10:
    km = int(input())
    K.append(km)
    m += 1

W3 = sorted(W, reverse=True)
a = W3[:3]
K3 = sorted(K, reverse =True)
b = K3[:3]

print(sum(a), sum(b))

Submission status: Accepted

Solution code:
a=[0]*10
b=[0]*10

for i in range(10):
    a[i]=int(input())

a.sort()
del a[0:7]

for i in range(10):
    b[i]=int(input())
    
b.sort()
del b[0:7]    
    
print(sum(a), sum(b))

Submission status: Accepted

Solution code:
a = []
b = []

for i in range(10):
  a.append(int(input()))
  a.sort()
W = sum(a[7:])

for j in range(10,20):
  b.append(int(input()))
  b.sort()
K = sum(b[7:])

print(f'{W} {K}')

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

W = []
K = []
for i in range(10):
   W.append(int(input()))
   W.sort()
   W.reverse()
for i in range(10):
   K.append(int(input()))
   K.sort()
   K.reverse()

print(sum(W[0:3]), sum(K[0:3]))

Submission status: Accepted

Solution code:
W = list(int(input()) for w in range(10))
w = sorted(W, reverse=True)
K = list(int(input()) for k in range(10))
k = sorted(K, reverse=True)
print(sum(w[:3]) , sum(k[:3]))

Submission status: Accepted

Solution code:
max_W1=0; max_W2=0; max_W3=0; sum_W=0
max_K1=0; max_K2=0; max_K3=0; sum_K=0

for i in range(10):
    W=int(input())
    if max_W1<W:
        max_W3=max_W2
        max_W2=max_W1
        max_W1=W
    elif max_W2<W:
        max_W3=max_W2
        max_W2=W
    elif max_W3<W:
        max_W3=W
    
for j in range(10):
    K=int(input())
    if max_K1<K:
        max_K3=max_K2
        max_K2=max_K1
        max_K1=K
    elif max_K2<K:
        max_K3=max_K2
        max_K2=K
    elif max_K3<K:
        max_K3=K

sum_W=max_W1+max_W2+max_W3
sum_K=max_K1+max_K2+max_K3
print(sum_W, sum_K)

Submission status: Accepted

Solution code:
w1=[]
k1=[]
for i in range(10):
    A=int(input())
    w1.append(A)
w=sorted(w1,reverse=True)
W=w[0]+w[1]+w[2]
for j in range(10):
    B=int(input())
    k1.append(B)
k=sorted(k1,reverse=True)
K=k[0]+k[1]+k[2]

print(W,K)

Submission status: Accepted

Solution code:
x=[]
y=[]


for i in range (10):
    A=int(input())
    x.append(A)
x1=sorted(x,reverse=True)

for j in range (10):
    B=int(input())
    y.append(B)
y1=sorted(y,reverse=True)
   
   
sum1=x1[0]+x1[1]+x1[2]
sum2=y1[0]+y1[1]+y1[2]

print(sum1,sum2)

Submission status: Accepted

Solution code:
a=[int(input()) for i in range(20)]
b=[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9]]
c=[a[10],a[11],a[12],a[13],a[14],a[15],a[16],a[17],a[18],a[19]]
b.sort()
c.sort()
print(sum(b[7:10]),sum(c[7:10]))

Submission status: Accepted

Solution code:
w=[]
k=[]
wm=[]
km=[]
for i in range(1,11):
    x=int(input())
    w.append(x)

for i in range(1,4):
    wma=max(w)
    wm.append(wma)
    w.remove(wma)

for i in range(1,11):
    x=int(input())
    k.append(x)

for i in range(1,4):
    kma=max(k)
    km.append(kma)
    k.remove(kma)

print(wm[0]+wm[1]+wm[2],km[0]+km[1]+km[2])

Submission status: Accepted

Solution code:
k = []
for num1 in range(2):
    w = []
    num3 = 0
    for num in range(10):
        i = int(input())
        w.append(i)
    w.sort()
    for num2 in range(7,10):
        num3 += w[num2]
    k.append(num3)
print(str(k[0]) + " " + str(k[1]))

Submission status: Accepted

Solution code:
W = []
K = []

for i in range(10) :
    W.append(int(input()))
    
for j in range(10) :
    K.append(int(input()))
    
Ws = sorted(W, reverse = True)
Ks = sorted(K, reverse = True)

w = 0
k = 0

for i in range(3) :
    w += Ws[i]
    k += Ks[i]
    
print(w, k)

Submission status: Accepted

Solution code:
W=list()
K=list()
for i in range(10):
  W.append(int(input()))
for i in range(10):
  K.append(int(input()))
W.sort()
K.sort()
print(sum(W[-3:]),sum(K[-3:]))

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(10)]
b = [int(input()) for i in range(10)]
a.sort(reverse = True)
b.sort(reverse = True)
print(sum(a[:3]),sum(b[:3]))

Submission status: Accepted

Solution code:
s = [int(input()) for _ in range(20)]
print(sum(sorted(s[:10], reverse=True)[:3]),
          sum(sorted(s[10:], reverse=True)[:3]))

Submission status: Accepted

Solution code:
w = [int(input()) for _ in range(10)]
k = [int(input()) for _ in range(10)]
print(sum(sorted(w)[7:]), sum(sorted(k)[7:]))

Submission status: Accepted

Solution code:
W=[int(input()) for i in range(10)]
K=[int(input()) for i in range(10)]
W.sort()
K.sort()
print(sum(W[7:10]),sum(K[7:10]))

Submission status: Accepted

Solution code:
def main():
    W = sorted([int(input()) for _ in range(10)], reverse=True)
    S = sorted([int(input()) for _ in range(10)], reverse=True)

    print(W[0] + W[1] + W[2], S[0] + S[1] + S[2])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
arr1 = []
arr2 = []
for i in range(10):
    arr1.append(int(input()))
for i in range(10):
    arr2.append(int(input()))
arr1.sort()
arr2.sort()

print(str(arr1[9] + arr1[8] + arr1[7]) + " " + str(arr2[9] + arr2[8] + arr2[7]))

Submission status: Accepted

Solution code:
W = [ int(input()) for i in range(10)]
W.sort()

K = [ int(input()) for i in range(10)]
K.sort()

print(f"{W[7]+W[8]+W[9]} {K[7]+K[8]+K[9]}")

Submission status: Accepted

Solution code:
W=[]
K=[]

for i in range(10):
    W.append(int(input()))
for i in range(10):
    K.append(int(input()))
  
W.sort(reverse=True)
K.sort(reverse=True)
   
print(W[0]+W[1]+W[2],K[0]+K[1]+K[2])

Submission status: Accepted

Solution code:
def souhei():
	lit=[]
	for unuse in range(10):
		lit.append(int(input()))
	x=0
	for asdf in range(3):
		m=max(lit)
		x+=m
		lit.remove(m)
	return(x)
print(str(souhei())+' '+str(souhei()))

Submission status: Accepted

Solution code:
W = [int(input()) for _ in range(10)]
K = [int(input()) for _ in range(10)]
W.sort()
K.sort()

sumW = sum(W[-3:])
sumK = sum(K[-3:])
print(sumW, sumK)

Submission status: Accepted

Solution code:
w = []
k = []
for _ in range(10):
    w.append(int(input()))

for _ in range(10):
    k.append(int(input()))

w.sort(reverse=True)
k.sort(reverse=True)

score_w = sum(w[:3])
score_k = sum(k[:3])

print(score_w, score_k)

Submission status: Accepted

Solution code:
from collections import deque
wuniversity = deque([])
for i in range(20):
    wuniversity.append(int(input()))
 
kuniversity = deque([])
for i in range(10):
    kuniversity.append(wuniversity.pop())
 
kuniversity = sorted(kuniversity)
wuniversity = sorted(wuniversity)
 
print(wuniversity[-1]+wuniversity[-2]+wuniversity[-3], end=' ')
print(kuniversity[-1]+kuniversity[-2]+kuniversity[-3])

Submission status: Accepted

Solution code:
#python3

w = [int(input()) for i in range(10)]
k = [int(input()) for i in range(10)]

w.sort()
k.sort()

w_score=w[-1]+w[-2]+w[-3]
k_score=k[-1]+k[-2]+k[-3]

print(w_score,k_score)

Submission status: Runtime Error

Solution code:
#import math

while True:
    w = []
    k = []
    for i in range(10):
        w.append(int(input()))
    for i in range(10):
        k.append(int(input()))
    w.sort()
    w.reverse()
    k.sort()
    k.reverse()
    print(w[0]+w[1]+w[2],k[0]+k[1]+k[2])

Submission status: Runtime Error

Solution code:
#import math

while True:
    w = []
    k = []
    for i in range(10):
        w.append(int(input()))
    for i in range(10):
        k.append(int(input()))
    w.sort()
    k.sort()
    print(sum(w[-3:]),sum(k[-3:]))

Submission status: Runtime Error

Solution code:
#import math

while True:
    w = []
    k = []
    for i in range(10):
        w.append(int(input()))
    for i in range(10):
        k.append(int(input()))
    w.sort()
    k.sort()
    print(sum(w[7:]),sum(k[7:]))

Submission status: Runtime Error

Solution code:
W = []
K = []

for i in range(20):
    W.append(int(input()))

for i in range(20):
    K.append(int(input()))

W.sort(reverse=True)
K.sort(reverse=True)

print(W[0] + W[1] + W[2])
print(K[0] + K[1] + K[2])

Submission status: Runtime Error

Solution code:
W=[input() for i in range(10)].sort()
K=[input() for i in range(10)].sort()
print sum(W[:3]),sum(K[:3])

Submission status: Runtime Error

Solution code:
w, k = [],[]
for i in range(10):
    w.append(int(raw_input())
for i in range(10):
    k.append(int(raw_input())
print sum(sorted(w)[-3:]),sum(sorted(k)[-3:])