s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
stringlengths
1
5
memory
stringlengths
1
7
code_size
stringlengths
1
6
code
stringlengths
1
539k
s967923296
p04046
u099566485
1531346590
Python
Python (3.4.3)
py
Runtime Error
184
14372
179
from scipy.special import comb h,w,a,b=map(int,input().split()) s=0 for i in range(1,h-a+1): s=s+comb(i-2+b,i-1,exact=True)*comb(w-b-1+h-i,w-b-1,exact=True) print(s%(10**9+7))
s811046672
p04046
u118605645
1530978126
Python
Python (3.4.3)
py
Runtime Error
2289
319860
449
H, W, A, B = (int(i) for i in input().split()) #H, W, A, B = (10, 7, 3, 4) #H, W, A, B = (2, 3, 1, 1) def mycomb(n, k): return factorials[n] / (factorials[k] * factorials[n - k]) MOD = int(1e9 + 7) factorials = [] factorials.append(1) for i in range(1, W + H): factorials.append(factorials[i - 1] * i) r = 0 for i in range(H - A): combination = mycomb(B-1+i, B-1) * mycomb(W+H-B-i-2, W-B-1) r += int(combination % MOD) print(r)
s406867392
p04046
u118605645
1530977972
Python
Python (3.4.3)
py
Runtime Error
2295
319860
444
H, W, A, B = (int(i) for i in input().split()) #H, W, A, B = (10, 7, 3, 4) #H, W, A, B = (2, 3, 1, 1) def mycomb(n, k): return factorials[n] / (factorials[k] * factorials[n - k]) MOD = int(1e9 + 7) factorials = [] factorials.append(1) for i in range(1, W + H): factorials.append(factorials[i - 1] * i) r = 0 for i in range(H - A): combination = mycomb(B-1+i, B-1) * mycomb(W+H-B-i-2, W-B-1) r += combination % MOD print(r)
s869620922
p04046
u329865314
1529970009
Python
Python (3.4.3)
py
Runtime Error
2134
501016
339
h,w,a,b = map(int,input().split()) dp = [[0 for _ in range(w)] for __ in range(h)] dp[0] = [1 for i in range(w)] mod = 10**9 + 7 for i in range(1,h): for j in range(w): if h-i <= a and w-j <= b: continue if j == 0: dp[i][j] = dp[i][j-1] % mod else: dp[i][j] = (dp[i][j-1] + dp[i-1][j]) % mod print(dp[h][w])
s904718383
p04046
u858575800
1527035714
Python
Python (3.4.3)
py
Runtime Error
120
3912
473
isPrime = [True for i in range(100001)] isPrime[0] = False isPrime[1] = False for i in range(2, 100001): if isPrime[i]: j = 2 while i*j <= 100000: isPrime[i*j] = False j += 1 q = int(input()) que = list() for i in range(q): que.append(list(map(int, input().split()))) for a, b in que: ans = 0 for i in range(a, b+1): if isPrime[i]: if isPrime[(i+1)//2]: ans += 1 print(ans)
s478565665
p04046
u327248573
1525135673
Python
Python (3.4.3)
py
Runtime Error
764
14548
479
import numpy as np from math import factorial H, W, A, B = map(int, input().split(' ')) def nCmRemain(n, m): return ((factorial(n)/factorial(n - m))/factorial(m)) % (pow(10,9)+7) path = np.zeros((A+1, W-B), dtype=np.int) for i in range(W-B): path[0][i] = nCmRemain(H-A+B-1+i,B+i) for i in range(A+1): path[i][0] = path[0][0] for i in range(1, A+1): for j in range(1, W-B): path[i][j] = (path[i-1][j] + path[i][j-1]) % (pow(10,9)+7) print(path[A][W-B-1])
s585833246
p04046
u268793453
1524784512
Python
Python (3.4.3)
py
Runtime Error
17
3064
397
h, w, a, b = [int(i) for i in input().split()] p = 10 ** 9 + 7 s = 0 fact = [1] for i in range(1, h+w-2): fact.append(fact[i-1] * i % p) rfact = [(h+w-2) % p] for i in range(h+w-1, 0, -1): rfact.append(rfact[-1] * i % p) rfact.reverse() def comb(n, r): return fact[n]//fact[n-r]//%pfact[r]%p for i in range(w-b): s += comb(h+w-a-2-i, w-1-i) * comb(a-1+i, a-1)%p print(s%p)
s173291530
p04046
u268793453
1524770074
Python
Python (3.4.3)
py
Runtime Error
17
3064
196
import scipy.misc as scm h, w, a, b = [int(i) for i in input().split()] p = 10 * * 9 + 7 s = 0 for i in range(w-b): s += scm.comb(h+w-a-2-i, w-1-i, 1) * scm.comb(a-1+i, a-1, 1) print(s%p)
s999587523
p04046
u826263061
1523840818
Python
Python (3.4.3)
py
Runtime Error
2108
21504
385
import numpy as np h, w, a, b = list(map(int, input().split())) nmod = 10**9+7 board = np.zeros((h+1, w+1), dtype=int) board[1,1] = 1 for x in range(1, h+1): for y in range(1, w+1): if x >= h-a+1 and y <= b: continue board[x,y] += board[x-1,y] + board[x,y-1] if board[x,y] >= nmod: board[x,y] = board[x,y] % nmod print(board[h,w])
s575051490
p04046
u621935300
1522008433
Python
Python (2.7.6)
py
Runtime Error
687
31672
540
import itertools import math H,W,A,B=map(int,raw_input().split()) mod=10**9+7 FACT={} FACT_INVERSE={} n=1 for i in range(H+W-1): if i==0: n=1 else: n=(n*i)%mod FACT[i]=n #print FACT def C(n,r): return (FACT[n]*pow(FACT[r],10**9+5 ,mod)*pow(FACT[n-r],10**9+5 ,mod)) %mod N=(H-A-1)+B M=(H-1)+(W-1)-N p=0 for i in range(H-A,H): #print N,i,M,(H-1)-i,C(N,i), C(M,(H-1)-i) p+=C(N,i)*C(M,(H-1)-i) #Count patterens via prohibited point. p=p%mod if C(N+M,(H-1))-p>=0: print C(N+M,(H-1))-p else: print C(N+M,(H-1))-p+10**9+7
s391811920
p04046
u621935300
1522007379
Python
Python (2.7.6)
py
Runtime Error
523
63900
580
import itertools import math H,W,A,B=map(int,raw_input().split()) mod=10**9+7 FACT={} FACT_INVERSE={} n=1 for i in range(H+W-1): if i==0: n=1 else: n=(n*i)%mod FACT[i]=n for x,y in FACT.items(): FACT_INVERSE[x]=pow(FACT[x],10**9+5 ,mod) def C(n,r): return (FACT[n]*FACT_INVERSE[r]*FACT_INVERSE[n-r]) %mod N=(H-A-1)+B M=(H-1)+(W-1)-N p=0 for i in range(H-A,H): #print N,i,M,(H-1)-i,C(N,i), C(M,(H-1)-i) p+=C(N,i)*C(M,(H-1)-i) #Count paterens through prohibited point. p=p%mod if C(N+M,(H-1))-p>=0: print C(N+M,(H-1))-p else: print C(N+M,(H-1))-p+10**9+7
s091161421
p04046
u672710370
1520495063
Python
Python (3.4.3)
py
Runtime Error
835
4980
645
import sys debug_mode = True if len(sys.argv) > 1 and sys.argv[1] == "-d" else False if debug_mode: import os inf = open(os.path.basename(__file__).replace(".py", ".in")) def input(): return inf.readline() else: inf = sys.stdin # ============================================================== def main(): h, w, a, b = [int(x) for x in input().strip().split()] from math import factorial r = h - a c = w - b res = factorial(r + c) / factorial(r) * factorial(c) print(res % (10**9 + 7)) main() # ============================================================== if debug_mode: inf.close()
s497316864
p04047
u666550725
1601039879
Python
PyPy3 (7.3.0)
py
Runtime Error
93
68384
127
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)
s525380249
p04047
u016844138
1600468485
Python
Python (3.8.2)
py
Runtime Error
24
8960
118
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)
s604076487
p04047
u468972478
1599700247
Python
Python (3.8.2)
py
Runtime Error
27
9020
116
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)
s981238232
p04047
u336236846
1599330640
Python
Python (3.8.2)
py
Runtime Error
23
9012
872
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
s389057621
p04047
u567493268
1597553747
Python
Python (3.8.2)
py
Runtime Error
27
8932
124
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)
s131254454
p04047
u567493268
1597553256
Python
Python (3.8.2)
py
Runtime Error
26
9044
192
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)
s509499974
p04047
u567493268
1597552533
Python
Python (3.8.2)
py
Runtime Error
22
8988
115
k=input() li=input() li.sort() sum=0 for k in range(len(li)): if k%2==0: sum=sum+li[k] print(sum)
s019316700
p04047
u419764866
1596648306
Python
Python (3.8.2)
py
Runtime Error
22
8884
165
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)):
s933900905
p04047
u353919145
1596511512
Python
Python (3.8.2)
py
Runtime Error
24
9068
99
n=int(input()) a=map(int,input().split()) ans=0 for i in range(0,2*n,2): ans+=a[i+1] print(ans)
s112597968
p04047
u860843282
1595298896
Python
Python (3.8.2)
py
Runtime Error
24
9388
313
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)
s280396540
p04047
u860843282
1595298764
Python
Python (3.8.2)
py
Runtime Error
26
9112
308
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
s821577378
p04047
u398988238
1594765025
Python
Python (3.8.2)
py
Runtime Error
23
9192
222
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)
s420396881
p04047
u864276028
1592882985
Python
Python (3.8.2)
py
Runtime Error
24
9140
118
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)
s838662080
p04047
u856671164
1592762651
Python
Python (3.8.2)
py
Runtime Error
25
9092
67
num = int(input()) li = int(input().split()) print(num) print(li)
s315159115
p04047
u034624359
1592429889
Python
Python (3.4.3)
py
Runtime Error
18
2940
108
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)
s665951821
p04047
u333873045
1592243942
Python
Python (3.4.3)
py
Runtime Error
17
3064
300
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))
s297588072
p04047
u657413968
1592085727
Python
Python (3.4.3)
py
Runtime Error
18
3060
318
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)
s854036133
p04047
u662430503
1591578636
Python
Python (3.4.3)
py
Runtime Error
17
2940
400
#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; }
s095870176
p04047
u292454598
1589723848
Python
Python (3.4.3)
py
Runtime Error
18
2940
141
kusiyaki = int(input()) kushi = [] for i in range(kusiyaki*2): kushi.append(int(input())) kushi = sorted(kushi) print(sum(kushi[0::2]))
s500945371
p04047
u292454598
1589722084
Python
Python (3.4.3)
py
Runtime Error
17
3064
433
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)
s806014864
p04047
u762420987
1582924122
Python
Python (3.4.3)
py
Runtime Error
18
2940
151
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)
s887744334
p04047
u328510800
1581568654
Python
Python (3.4.3)
py
Runtime Error
17
2940
30
5 100 1 2 3 14 15 58 58 58 29
s710307205
p04047
u636014233
1580717735
Python
Python (3.4.3)
py
Runtime Error
17
2940
110
N = int(input()) li = list(map(int, input().split)) li.sort() P = 0 for i in range(N): P += li[i*2] print(P)
s993948380
p04047
u000274293
1576034374
Python
Python (3.4.3)
py
Runtime Error
17
2940
52
N = int(input()) L = input().split(' ') for i in L:
s635655531
p04047
u824237520
1575556462
Python
Python (3.4.3)
py
Runtime Error
17
2940
114
n = int(n) a = list(map(int, input().split())) a.sort() ans = 0 for i in range(n): ans += a[i*2] print(ans)
s004103608
p04047
u109617108
1572623297
Python
PyPy3 (2.4.0)
py
Runtime Error
182
38256
112
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)
s329904741
p04047
u879870653
1570154241
Python
Python (2.7.6)
py
Runtime Error
10
2568
122
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)
s529233422
p04047
u161318582
1569884352
Python
Python (3.4.3)
py
Runtime Error
17
2940
109
a = input() x = sorted(list(map(int,input().split()))) cnt=0 for i in range(a-1): cnt += x[2*i] print(cnt)
s168606739
p04047
u161318582
1569884239
Python
Python (3.4.3)
py
Runtime Error
17
2940
106
a = input() x = sorted(list(map(int,input().split()))) cnt=0 for i in range(a): cnt += x[2*i] print(cnt)
s189986491
p04047
u233747425
1568678564
Python
Python (3.4.3)
py
Runtime Error
17
2940
140
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)
s197666718
p04047
u676833945
1566430936
Python
Python (3.4.3)
py
Runtime Error
17
3060
170
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)
s915240495
p04047
u676833945
1566430846
Python
Python (3.4.3)
py
Runtime Error
17
3060
162
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)
s679727884
p04047
u933750963
1565923864
Python
Python (3.4.3)
py
Runtime Error
17
2940
47
x,y=map(int,input().split()) z=3.5*y+x print(z)
s569317134
p04047
u933750963
1565923818
Python
Python (3.4.3)
py
Runtime Error
17
2940
47
x,y=map(int,input().split()) z=3.5*y+x print(z)
s705752314
p04047
u418466780
1565849978
Python
Python (3.4.3)
py
Runtime Error
21
3316
959
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())
s220467221
p04047
u993493158
1565745876
Python
Python (3.4.3)
py
Runtime Error
19
2940
159
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))
s077974989
p04047
u047397602
1565394680
Python
Python (3.4.3)
py
Runtime Error
1072
22020
163
import numpy as np cnt = input() arr = input() arr = map(int, arr.split(' ')) r = np.array(sorted(arr)[::-1]) print(sum([min(pair) for pair in r.reshape(5,2)]))
s040814645
p04047
u263830634
1563739745
Python
PyPy3 (2.4.0)
py
Runtime Error
166
38256
2340
#座標平面に落とし込んで再帰関数で無理やり計算 # import numpy as np import sys sys.setrecursionlimit(10 ** 5) N, X = map(int, input().split()) if 2 * X > N: #対称性 X = N - X #座標の作成 dp = [[-1] * (N+3)] for i in range(N+1): tmp = [-1] for j in range(N+1): if i <= j: tmp.append(0) #到達していないマス else: tmp.append(-1) #壁(範囲外) tmp.append(-1) tmp.reverse() dp.append(tmp) dp.append([-1] * (N+3)) # print (np.array(dp)) #m: 0:右へ, 1:左下へ, 2:左上へ def moving(x, y, total, m): if x == X and y == 1 and dp[x][y] == 1: #一周回ってもとの座標に戻ってきた時 # print ('D') return total if m == 0: #右に動く時 tmp = 0 while dp[x-1][y+1] == 0: #右に進める時 dp[x-1][y+1] = 1 #右進んだマスを到達したことにする tmp += 1 x -= 1 y += 1 if dp[x-1][y+1] == -1: #右側が壁の時-->左下に進む # print ('1-B') return moving(x, y, total + tmp, 1) if dp[x-1][y+1] == 1: #右側が光の線の時-->左上へ進む tmp += 1 # print ('1-C') return moving(x-1, y+1, total + tmp, 2) if m == 1: #左下へ動く時 tmp = 0 while dp[x+1][y] == 0: #左下に進める時 dp[x+1][y] = 1 tmp += 1 x += 1 if dp[x+1][y] == -1: #左下が壁の時-->左上に進む # print ('2-C') return moving(x, y, total + tmp, 2) if dp[x+1][y] == 1: #左下が光の線の時-->左上に進む tmp += 1 # print ('2-C') return moving(x+1, y, total + tmp, 2) if m == 2: #左上に動く時 tmp = 0 while dp[x][y-1] == 0: #左上に進める時 dp[x][y-1] = 1 tmp += 1 y -= 1 if dp[x][y-1] == -1: #左上が壁の時-->右に進む # print ('3-A') return moving(x, y, total + tmp, 0) if dp[x][y-1] == 1: #左上が光の線の時-->左下に進む tmp += 1 # print ('3-B') return moving(x, y-1, total + tmp, 1) X += 1 print (moving(X, 1, 0, 0)) # print (np.array(dp))
s564078703
p04047
u971161994
1560628071
Python
Python (3.4.3)
py
Runtime Error
17
2940
149
N = int(input()) L =[] for i in range(N*2): guzai=int(input()) L.append(guzai) L.sort() L_even=L[0::2] goukei=sum(L_even) print(str(goukei))
s221093562
p04047
u971161994
1560627618
Python
Python (3.4.3)
py
Runtime Error
17
2940
122
N = int(input()) L =[] guzai=int(input()) L.append(guzai) L.sort() L_even=L[0::2] goukei=sum(L_even) print(str(goukei))
s484281013
p04047
u560988566
1559965886
Python
Python (3.4.3)
py
Runtime Error
17
2940
116
n = int(input()) l = [map(int, input().split())] ans = 0 l.sort() for i in range(n): ans += l[2*i] print(ans)
s342698874
p04047
u305052967
1559254021
Python
Python (3.4.3)
py
Runtime Error
17
2940
114
N = int(input()) L = list(map(int, input().split())) L.sort() s = 0 for n in range(N): s += L[2*n} print(s)
s297416464
p04047
u305052967
1559253812
Python
Python (3.4.3)
py
Runtime Error
17
2940
115
N = int(input()) L = list(map(int,input().split()) L.sort() s = 0 for n in range(N): s += L[2*n] print(s)
s602627412
p04047
u305052967
1559253743
Python
Python (3.4.3)
py
Runtime Error
17
2940
110
N = input() L = list(map(int,input().split()) L.sort() s = 0 for n in range(N): s += L[2*n] print(s)
s587747630
p04047
u305052967
1559253714
Python
Python (3.4.3)
py
Runtime Error
17
2940
113
N =int( input()) L = list(map(int,input().split()) L.sort s = 0 for n in range(N): s += L[2*n] print(s)
s045552452
p04047
u305052967
1559253643
Python
Python (3.4.3)
py
Runtime Error
17
2940
105
N = input() L = list(map(int,input().split()) L.sort s = 0 for n in range(N): s += L[2*n] print(s)
s043187364
p04047
u169639579
1557888138
Python
Python (3.4.3)
py
Runtime Error
17
2940
141
N = int(input()) s = map(int,input().split()) list(s).sort(reverse=True) sum = 0 for i in range(N): sum = sum +list(s)[2*i] print(sum)
s292103477
p04047
u169639579
1557887957
Python
Python (3.4.3)
py
Runtime Error
17
2940
120
N = int(input()) s = map(int,input().split()) s.sort() sum = 0 for i in range(N): sum = sum + s[2*i+1] print(sum)
s663985852
p04047
u169639579
1557887904
Python
Python (3.4.3)
py
Runtime Error
17
2940
118
N = int(input()) s = map(int,input().split()) s.sort() sum = 0 for i in range(N): sum = sum + s[2*i] print(sum)
s359938455
p04047
u169639579
1557887840
Python
Python (3.4.3)
py
Runtime Error
17
2940
130
N = int(input()) s = map(int,input().split()) s.sort(reverse=True) sum = 0 for i in range(N): sum = sum + s[2*i] print(sum)
s147710525
p04047
u169639579
1557887687
Python
Python (3.4.3)
py
Runtime Error
17
2940
121
N = int(input()) s = input().split() s.sort(reverse=True) sum = 0 for i in range(N): sum = sum + s[2*i] print(sum)
s454116567
p04047
u273928723
1557521411
Python
Python (3.4.3)
py
Runtime Error
18
3060
127
n=input() a=input().split() a=[int(i) for i in a] a=a.sorted() count=0 ans=0 for i in a: if count%2==0: ans+=i count+=1
s493625966
p04047
u023229441
1556683203
Python
Python (3.4.3)
py
Runtime Error
17
2940
85
n=int(input());print(sum(sorted(list(map(int,input().split())))[::2])) print("RE WA?"
s238459113
p04047
u782238920
1555850939
Python
Python (3.4.3)
py
Runtime Error
17
2940
84
b=input() a=int(input().split(" ")) sum=0 for i in a: sum=sum+i sum//=2 print(sum)
s007995682
p04047
u782238920
1555850887
Python
Python (3.4.3)
py
Runtime Error
17
2940
71
a=int(input().split()) sum=0 for i in a: sum=sum+i sum//=2 print(sum)
s956852856
p04047
u655048024
1554641753
Python
Python (3.4.3)
py
Runtime Error
18
2940
129
N = int(input()) c=list(map(int, input().split())) c.sort() Max = 0 for i in range(N): K = 2*N Max = Max + c[K] print(Max)
s320410504
p04047
u844902298
1553831194
Python
Python (3.4.3)
py
Runtime Error
17
2940
118
n = int(input()) s = list(map(int,input().split())) s.sort() sum = 0 for i in range(0,2n,2): sum += s[i] print(sum)
s184275577
p04047
u684695949
1553741095
Python
Python (3.4.3)
py
Runtime Error
17
2940
158
def f(a,b): if a==b: return 2*a elif a < b: return 2*a* + f(a,b-a) else: return 2*b + f(a-b,b) N,X = map(int,input().split(" ")) print(N+f(N-X,X))
s133312272
p04047
u518042385
1553622893
Python
Python (3.4.3)
py
Runtime Error
18
2940
108
n=int(input()) l=list(map(int,input().split())) l=set(l) z=0 for i in range(n): z+=l[2*i] print(z)
s857914787
p04047
u298297089
1552430629
Python
Python (3.4.3)
py
Runtime Error
18
2940
136
num = input() num_list = list(map(int, input().split()))sort() i = 0 sum = 0 while i < num * 2: sum += num_list[i] i += 2 print(sum)
s576295253
p04047
u525796732
1551769201
Python
Python (3.4.3)
py
Runtime Error
18
3064
466
def main(): n,x=map(int,input().split()) a,b=n-x,x if(a<b): a,b=b,a path_length = calc_path(a,b,n) print(path_length) def calc_path(a1,b1,c1): q , mod=divmod(a1,b1) count=0 if mod==0: c2=c1+2*b1*q-b1 return c2 else: count=count+1 c2=c1+2*b1*q a2=a1-b1*q b2=b1 if(a2<b2): a2,b2=b2,a2 return calc_path(a2,b2,c2) if __name__=='__main__': main()
s947081620
p04047
u525796732
1551768212
Python
Python (3.4.3)
py
Runtime Error
17
3064
467
def main(): n,x=map(int,input().split()) a,b=n-x,x if(a<b): a,b=b,a path_length = calc_path(a,b,n) print(path_length) def calc_path(a1,b1,c1): q , mod=divmod(a1,b1) count=0 if mod==0: c2=c1+b1*(q+1) return c2 else: count=count+1 c2=c1+b1*(q+1) a2=a1-b1*q b2=b1 if(a2<b2): a2,b2=b2,a2 return calc_path(a2,b2,c2) if __name__=='__main__': main()
s836937692
p04047
u033524082
1551376328
Python
Python (3.4.3)
py
Runtime Error
18
2940
226
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)n=int(input()) l=list(map(int,input().split())) l.sort() ans=0 for i in range([0,]n[,2]): ans+=l[i] print(ans)
s040201729
p04047
u033524082
1551375972
Python
Python (3.4.3)
py
Runtime Error
18
2940
112
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)
s874033754
p04047
u201968280
1550183199
Python
Python (3.4.3)
py
Runtime Error
17
2940
175
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)
s142733593
p04047
u201968280
1550183117
Python
Python (3.4.3)
py
Runtime Error
18
2940
179
n = int(input()) table = list(map(int,input().split())) table.sort() count = 0 for i in range(1,n+1): if i%2 = 1: count += table[i] else: pass print(count)
s822001572
p04047
u016567570
1550025392
Python
Python (3.4.3)
py
Runtime Error
18
2940
121
#-*- coding: utf-8 -*- N = int(input()) L_list = [int(input()) for n in range(2N)] L_list.sort() print(sum(L_list[::2]))
s617248161
p04047
u016567570
1550025378
Python
Python (3.4.3)
py
Runtime Error
17
2940
122
#-*- coding: utf-8 -*- N = int(input()) L_list = [int(input()) for n in range(2N)] L_list.sort() print(sum(L_list[1::2]))
s605778442
p04047
u740284863
1549594540
Python
Python (3.4.3)
py
Runtime Error
18
2940
76
from fractionsimport gcd n,x=map(int,input().split()) print(3*(n-gcd(n,x)))
s631135163
p04047
u904804404
1549251066
Python
Python (3.4.3)
py
Runtime Error
18
3060
231
def tri_len(x,y): if x== y: return x elif x < y: return tri_len(y-x,x)+2*x else: return tri_len(x-y,y)+2*y import sys sys.setrecursionlimit(100000) n,x= list(map(int,input().split(" "))) print( n+tri_len(x,n-x))
s396854922
p04047
u904804404
1549251030
Python
Python (3.4.3)
py
Runtime Error
17
3064
230
def tri_len(x,y): if x== y: return x elif x < y: return tri_len(y-x,x)+2*x else: return tri_len(x-y,y)+2*y import sys sys.setrecursionlimit(10000) n,x= list(map(int,input().split(" "))) print( n+tri_len(x,n-x))
s559310751
p04047
u904804404
1549249722
Python
Python (3.4.3)
py
Runtime Error
17
2940
125
a = input() lst = input().split(" ") lst.sort() ans=0 for i in range(int(len(lst))): ans += lst[len(lst)-2*i-2] print(ans)
s489605749
p04047
u942393279
1548783358
Python
Python (3.4.3)
py
Runtime Error
18
2940
251
#include<bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; int d=0; int a[N*2]; for(int i=0;i<N*2;i++){ cin>>a[i]; } sort(a,a+N); for(int l=0;l<N*2;l+=2){ d+=a[l]; } cout<<d<<endl; }
s304691375
p04047
u416522077
1548642902
Python
Python (3.4.3)
py
Runtime Error
288
21248
499
import sys import numpy as np N_stick = int(sys.argv[1]) left = [0 for i in range(N_stick)] right = [0 for i in range(N_stick)] stuff = [ 0 for i in range(N_stick*2)] for i in range(N_stick*2): stuff[i] = sys.argv[i+2] left = [ int(stuff[2*i]) for i in range(N_stick)] right = [ int(stuff[2*i+1]) for i in range(N_stick)] total = left + right sortedlist = sorted(total) for i in range(N_stick): left[i] = sortedlist[2*i] right[i] = sortedlist[2*i+1] meat = sum(left) print(meat)
s234847450
p04047
u190882678
1548295455
Python
Python (3.4.3)
py
Runtime Error
18
3064
532
input_word = input() input_list = input_word.split(" ") N = int(input_list[0]) K = int(input_list[1]) input_word = input() tmp_list = input_word.split(" ") input_list = [ int(i) for i in tmp_list ] while True: flag = 0 for i in range(1,N): number = input_list.index(i) number_1 = input_list.index(i+1) if number - number_1 >= K: input_list[number_1],input_list[number] = input_list[number],input_list[number_1] flag = 1 break if flag == 0: break for i in input_list: print(i)
s662189078
p04047
u089032001
1546496520
Python
Python (3.4.3)
py
Runtime Error
19
2940
116
n = int(input()) A = list(map(int, input().split())).sort() ans = 0 for a, b in zip(A, A[1:]): ans += a print(ans)
s736262531
p04047
u459233539
1546318834
Python
Python (3.4.3)
py
Runtime Error
19
2940
87
n=int(input()) l=sorted(list(map(int,input().split())),reverse=True) print(sum(l[1::2])
s445061163
p04047
u459233539
1546318792
Python
Python (3.4.3)
py
Runtime Error
17
2940
86
n=int(input()) l=sorted(list(map(int,iput().split())),reverse=True) print(sum(l[1::2])
s008080090
p04047
u459233539
1546318677
Python
Python (3.4.3)
py
Runtime Error
17
2940
85
n=int(input()) l=sorted(list(map(int,iput().split()),reverse=True) print(sum(l[1::2])
s928145687
p04047
u371467115
1545852281
Python
Python (3.4.3)
py
Runtime Error
18
2940
92
n=int(input()) l=[input() for i in range(n)] l.sort() s=0 for j in l[::2]: s+=j print(s)
s592034106
p04047
u928784113
1545058523
Python
Python (3.4.3)
py
Runtime Error
18
2940
152
# -*- coding: utf-8 -*- N = int(input()) a = [int(input()) for i in range(2*N)] L = sort(a) b = [] for i in range(2*N): b.append(a[2*i]) print(sum(b))
s357077322
p04047
u928784113
1545058490
Python
Python (3.4.3)
py
Runtime Error
18
2940
150
# -*- coding: utf-8 -*- N = int(input()) a = [int(input()) for i in range(2N)] L = sort(a) b = [] for i in range(2N): b.append(a[2*i]) print(sum(b))
s316320577
p04047
u928784113
1545058461
Python
Python (3.4.3)
py
Runtime Error
18
2940
147
# -*- coding: utf-8 -*- N = int(input()) a = [int(input()) for i in range(2N)] L = sort(a) b = [] for i in range(2N) b.append(a[2*i]) print(sum(b))
s950638019
p04047
u258375111
1544232681
Python
Python (3.4.3)
py
Runtime Error
18
2940
126
n = int(input()) x = list(map(int, input().split())) x.sort() ans = 0 for i range(n): ans = ans + x[i*2] print(ans)
s725018604
p04047
u258375111
1544232601
Python
Python (3.4.3)
py
Runtime Error
18
2940
126
n = int(input()) x = list(map(int, input().split())) x.sort() ans = 0 for i range(n): ans = ans + x[i*2] print(ans)
s855412902
p04047
u258375111
1544232584
Python
Python (3.4.3)
py
Runtime Error
17
2940
127
n = int(input()) x = list(map(int, input().split())) x.sort() ans = 0 for i range(n): ans = ans + x[i*2] print(ans)
s638403161
p04047
u258375111
1544232540
Python
Python (3.4.3)
py
Runtime Error
17
2940
125
n= int(input()) x= list(map(int, input().split())) x.sort() ans = 0 for i range(n): ans = ans + x[i*2] print(ans)
s422829839
p04047
u258375111
1544232453
Python
Python (3.4.3)
py
Runtime Error
17
2940
123
n=int(input()) x=list(map(int, input().split())) x.sort() ans = 0 for i range(n): ans = ans + x[i*2] print(ans)