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
s903954589
p03776
u191829404
1560119978
Python
Python (3.4.3)
py
Runtime Error
192
14984
1342
import math import copy from operator import mul from functools import reduce from collections import defaultdict from collections import Counter from collections import deque # 直積 A={a, b, c}, B={d, e}:のとき,A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B) from itertools import product # 階乗 P!: permutations(seq)...
s203951172
p03776
u885899351
1559866070
Python
Python (3.4.3)
py
Runtime Error
19
3064
525
def pascal(n,r): global p while len(p)<50: pi=[1] for i in range(len(p)): pi.append(p[-1][i]+p[-1][i+1]) pi.append(1) p.append(pi) return p[n-1][r] n,a,b=map(int,input().split()) v=sorted(list(map(int,input().split())))[::-1] va=v[:a] val=va[-1] print(sum(va)/a) ...
s775739971
p03776
u885899351
1559866027
Python
Python (3.4.3)
py
Runtime Error
18
3064
524
def pascal(n,r): global p while len(p)<n: pi=[1] for i in range(len(p)): pi.append(p[-1][i]+p[-1][i+1]) pi.append(1) p.append(pi) return p[n-1][r] n,a,b=map(int,input().split()) v=sorted(list(map(int,input().split())))[::-1] va=v[:a] val=va[-1] print(sum(va)/a) p...
s652783535
p03776
u102960641
1558795129
Python
Python (3.4.3)
py
Runtime Error
23
3572
593
from functools import reduce from operator import mul import bisect def cmb(n, r): r = min(n - r, r) if r == 0: return 1 return reduce(mul, range(n, n - r, -1)) // reduce(mul, range(r, 0, -1)) n,a,b = map(int, input().split()) v = list(map(int, input().split())) v.sort(reverse = True) if v[0] == v...
s978520903
p03776
u798129018
1558377284
Python
PyPy3 (2.4.0)
py
Runtime Error
174
38768
785
from itertools import* from math import* from collections import* from heapq import* from bisect import bisect_left,bisect_right from copy import deepcopy inf = 10**18 mod = 10**9+7 from functools import reduce import sys sys.setrecursionlimit(10**7) def comb(n,r): return factorial(n)//(factorial(n-r)*factorial(r))...
s014997013
p03776
u365364616
1556567172
Python
Python (3.4.3)
py
Runtime Error
19
3064
840
def value_and_count(x): d = {} for xi in x: if xi in d.keys(): d[xi] += 1 else: d[xi] = 1 return d def comb(n, k): k = min(n - k, k) denominator = 1 # 分母 numerator = 1 # 分子 for i in range(k): denominator *= i + 1 numerator *= n - i ...
s678837947
p03776
u041075929
1555781387
Python
Python (3.4.3)
py
Runtime Error
75
3912
723
import sys, os f = lambda:list(map(int,input().split())) if 'local' in os.environ : sys.stdin = open('./input.txt', 'r') def fac(n): if n== 1 or n == 0: return 1 return n * fac(n-1) def comb(n, k): return fac(n)/(fac(k) * fac(n-k)) def solve(): n, a, b = f() v = f() v = sort...
s646576185
p03776
u879581330
1555260354
Python
Python (3.4.3)
py
Runtime Error
17
2940
919
#include <bits/stdc++.h> using namespace std; long long Combination(int n, int r) { vector<vector<long long>> C(n + 1, vector<long long>(n + 1, 1)); for (int i = 1; i <= n; i++) for (int j = 1; j < i; j++) C[i][j] = C[i - 1][j - 1] + C[i - 1][j]; return C[n][r]; } int main() { int N, A, B; cin >> N >> A >> ...
s012353826
p03776
u813102292
1554584055
Python
Python (3.4.3)
py
Runtime Error
74
3916
555
def fuct(n:int)->int: if n==1: return 1 else: return n * fuct(n-1) def main(): n,a,b = map(int, input().split()) v = list(map(int, input().split())) v = sorted(v, reverse=True) print(sum(v[:a])/a) res = 0 if v[0]==v[a-1]: vn = v.count(v[0]) for r in rang...
s352883266
p03776
u268516119
1553742991
Python
Python (3.4.3)
py
Runtime Error
17
2940
168
import math N=int(input()) for i in reversed(range(1,math.ceil(math.sqrt(N))+1)): if N%i==0: B=N//i print(math.floor(math.log10(B))+1) break
s904692793
p03776
u572144347
1553691568
Python
PyPy3 (2.4.0)
py
Runtime Error
205
45552
649
N, A, B = map(int, input().split()) V = list(map(int, input().split())) V.sort(reverse=True) mean = sum(V[:A]) / A mean = float(mean) print(mean) def fact(n): if n == 0 or n == 1: return 1 return fact(n-1) * n def comb(n,a): return fact(n)//fact(a)//fact(n-a) from collections import Counter c = Count...
s144953623
p03776
u572144347
1551447757
Python
Python (3.4.3)
py
Runtime Error
17
3060
394
N,A,B=map(int,input().split()) V=list(map(int,input().split())) V=sorted(V,reverse=True) def fac(n): if n<= 1: return 1 return n*fac(n-1) def c (a,b): if b==0: return 1 return fac(a)//fac(b)//fac(a-b) print(sum(V[:A])/A) if V.count(V[0]) >= A: ans=0 for i in range(A, min(B+1,V.count(V[A])+1))): ans...
s741698706
p03776
u572144347
1551447072
Python
Python (3.4.3)
py
Runtime Error
18
3060
380
N,A,B=map(int,input().split()) V=list(map(int,input().split())) V=sorted(V,reverse=True) def fac(n): if n== 1: return 1 return n*fac(n-1) def c (a,b): if b==0: return 1 return fac(a)//fac(b)//fac(a-b) print(sum(V[:A])/A) if V.count(V[A]) >= A: ans=0 for i in range(A, min(B+1,V.count(V[A])+1))): ans...
s786107828
p03776
u255280439
1550811603
Python
Python (3.4.3)
py
Runtime Error
17
2940
1024
aimport sys import collections def comb(n, r): if n - r < r: r = n - r if r == 0: return 1 if r == 1: return n numerator = [n - r + k + 1 for k in range(r)] denominator = [k + 1 for k in range(r)] for p in range(2, r + 1): pivot = denominator[p - 1] if pivot > 1: o...
s715528844
p03776
u255280439
1550811426
Python
Python (3.4.3)
py
Runtime Error
17
3064
345
import sys N, A, B = [int(_) for _ in sys.stdin.readline().split()] V = sorted([int(_) for _ in sys.stdin.readline().split()], reverse=True) D = collections.defaultdict(lambda: 0) ans = 0 for C in range(A, B+1): if (sum(V[:C]) / C) == (sum(V[:A]) / A): ans += comb(V.count(V[C-1]), V[:C].count(V[C-1])) print(su...
s117784934
p03776
u255280439
1550811367
Python
Python (3.4.3)
py
Runtime Error
18
3064
399
def main(): N, A, B = [int(_) for _ in sys.stdin.readline().split()] V = sorted([int(_) for _ in sys.stdin.readline().split()], reverse=True) D = collections.defaultdict(lambda: 0) ans = 0 for C in range(A, B+1): if (sum(V[:C]) / C) == (sum(V[:A]) / A): ans += comb(V.count(V...
s224142930
p03776
u255280439
1550811324
Python
Python (3.4.3)
py
Runtime Error
18
3064
398
def main(): N, A, B = [int(_) for _ in sys.stdin.readline().split()] V = sorted([int(_) for _ in sys.stdin.readline().split()], reverse=True) D = collections.defaultdict(lambda: 0) ans = 0 for C in range(A, B+1): if (sum(V[:C]) / C) == (sum(V[:A]) / A): ans += comb(V.count(V...
s730493669
p03776
u001024152
1550356283
Python
Python (3.4.3)
py
Runtime Error
21
3316
553
# D N,A,B = map(int, input().split()) v = list(map(int, input().split())) v.sort(reverse=True) max_mean = sum(v[:A])/A print(max_mean) from collections import Counter from math import factorial def comb(n,r): return factorial(n)//(factorial(r)*factorial(n-r)) v_count = Counter(v) ans = 0 if v[0]==v[A-1]: n ...
s420482283
p03776
u001024152
1550356086
Python
Python (3.4.3)
py
Runtime Error
22
3316
515
# D N,A,B = map(int, input().split()) v = list(map(int, input().split())) v.sort(reverse=True) max_mean = sum(v[:A])/A print(max_mean) from collections import Counter from math import factorial def comb(n,r): return factorial(n)//(factorial(r)*factorial(n-r)) v_count = Counter(v) ans = 0 if v[0]==v[A-1]: n ...
s922199977
p03776
u089032001
1548820817
Python
Python (3.4.3)
py
Runtime Error
346
22892
565
from collections import Counter from scipy.special import comb def inpl(): return list(map(int, input().split())) N, a, b = inpl() array = inpl() value = Counter(array) array.sort(reverse=True) ans = {} sum_a = 0 kosuu = 0 last = -1 # print("koko") for i, num in enumerate(array): # print(i, num) sum_a += num...
s948087466
p03776
u745087332
1548576257
Python
Python (3.4.3)
py
Runtime Error
22
3316
1060
# coding:utf-8 import sys import math from collections import defaultdict INF = float('inf') MOD = 10 ** 9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): return int(sys.stdin.readline()) def SI(): return input() def comb(n, r): if n -...
s768340250
p03776
u745087332
1548572788
Python
Python (3.4.3)
py
Runtime Error
22
3316
1035
# coding:utf-8 import sys import math from collections import defaultdict INF = float('inf') MOD = 10 ** 9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): return int(sys.stdin.readline()) def SI(): return input() def comb(n, r): return...
s840120163
p03776
u923279197
1546049530
Python
Python (3.4.3)
py
Runtime Error
18
3064
623
def combination(n, r): # nCrを求める r = min(n - r, r) result = 1 for i in range(n, n - r, -1): result *= i for i in range(1, r + 1): result //= i return result n,a,b = map(int,input().split()) v = list(map(int,input().split())) v.sort(reverse=True) ans1 = v[:a]/a num1 = v[:a].count(v...
s371800047
p03776
u026102659
1545876361
Python
Python (3.4.3)
py
Runtime Error
19
3064
424
import math N, A, B = map(int, input().split()) nums = list(map(int, input().split())) arg = 0 num = 0 j = N - A nums.sort() for i in range(A): arg += nums[N - i - 1] arg = arg/A if nums[j] == nums[N-1]: re = nums.count(nums[j]) for i in range(A, B+1): num = num + math.factorial(re) / math.factori...
s866816202
p03776
u366133198
1542464013
Python
Python (3.4.3)
py
Runtime Error
103
5620
1341
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ https://beta.atcoder.jp/contests/abc057/tasks/abc57_1 """ import sys import math from inspect import currentframe def debug(*args): names = {id(v):k for k,v in currentframe().f_back.f_locals.items()} print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for ...
s048138381
p03776
u623601489
1540780762
Python
Python (3.4.3)
py
Runtime Error
17
2940
161
N,A,B=map(int,input().split()) lst=list(map(int,input().split())) lst.sort() a=lst[-A:] print(sum(a)/A) b=lst.count(a[0]) c=lst.count(a[0]) print(b!/(c!*(b-c)!))
s650265482
p03776
u170201762
1540709279
Python
Python (3.4.3)
py
Runtime Error
152
12512
803
def fact(n): if n == 0: return 1 else: return n*fact(n-1) def conb(n,r): return fact(n)//(fact(r)*fact(n-r)) N,A,B = map(int,input().split()) v = list(map(int,input().split())) v.sort() v.reverse() d_all = {} for i in range(N): if v[i] not in d_all: d_all[v[i]] = 0 d_all[v[i...
s816048196
p03776
u368780724
1540646741
Python
Python (3.4.3)
py
Runtime Error
208
15976
436
def inpl(): return [int(i) for i in input().split()] N, A, B = inpl() V = inpl() V = list(reversed(sorted(V))) x1 = N-1 x2 = 0 for i in range(N): if V[i] == V[A]: x1 = min(x1,i) x2 = max(x2,i) print(sum(V[0:A])/A) from scipy.special import comb ans = 0 if x1 == 0: for l in range(min(B-1,x2)-A+...
s729170558
p03776
u270681687
1540074298
Python
Python (3.4.3)
py
Runtime Error
21
3316
681
from collections import Counter from itertools import combinations n, a, b = map(int, input().split()) v = list(map(int, input().split())) v.sort(reverse=True) v_cum = [] num = 0 for i in range(n): num += v[i] v_cum.append(num) print(v_cum[a-1]/a) if a == n: print(1) else: if v[a-1] == v[a]: ...
s500521986
p03776
u102126195
1538968550
Python
Python (3.4.3)
py
Runtime Error
18
3064
1015
def ABC057D(): N, A, B = map(int, input().split()) v = list(map(int, input().split())) v = sorted(v)[::-1] anslist = [] for i in range(A, B + 1): anslist.append([sum(v[0:i]) / i, i, v[i - 1]]) anslist.sort() anslist = anslist[::-1] ans = anslist[0][0] key = anslist[0][2] ...
s741386962
p03776
u631277801
1536577687
Python
Python (3.4.3)
py
Runtime Error
26
3444
1966
import sys stdin = sys.stdin def li(): return [int(x) for x in stdin.readline().split()] def li_(): return [int(x)-1 for x in stdin.readline().split()] def lf(): return [float(x) for x in stdin.readline().split()] def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip() def lc(): return lis...
s323592505
p03776
u631277801
1536577516
Python
Python (3.4.3)
py
Runtime Error
22
3444
1957
import sys stdin = sys.stdin def li(): return [int(x) for x in stdin.readline().split()] def li_(): return [int(x)-1 for x in stdin.readline().split()] def lf(): return [float(x) for x in stdin.readline().split()] def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip() def lc(): return lis...
s140982237
p03776
u550574002
1536229670
Python
Python (3.4.3)
py
Runtime Error
17
3064
309
n,a,b = map(int,input().split()) vs = sorted([int(v) for v in input().split()],reverse=True) print(sum(vs[:a])/a) binom = [1] for k in range(vs.count(vs[a-1])): binom = [x+y for (x, y) in zip(binom+[0],[0]+binom)] if vs[a-1] == vs[0]: print(sum(binom[a:b+1])) else: print(binom[vs.index(vs[a-1])])
s311805688
p03776
u255280439
1535765257
Python
Python (3.4.3)
py
Runtime Error
191
14884
3161
import sys import math import collections import itertools import array import inspect from scipy.special import comb # Set max recursion limit sys.setrecursionlimit(1000000) # Debug output def chkprint(*args): names = { id(v): k for k, v in inspect.currentframe().f_back.f_locals.items() } ...
s545772974
p03776
u445863230
1530230310
Python
Python (3.4.3)
py
Runtime Error
18
3064
631
poo=input().split() shoop=[1] lop=[] for i in range(int(poo[0])): lop.append(int(input())) shoop.append(shoop[i]*(i+1)) jop=lop.copy() j=int(poo[1]) staph=int(poo[2]) joop=0 z=0 zop=jop.count(max(jop)) while z<j: joop+=max(lop) lop.remove(max(lop)) z+=1 print(joop/j) jum=1 shazam=0 while j>=zop: ...
s467836587
p03776
u445863230
1530226160
Python
Python (3.4.3)
py
Runtime Error
18
3064
636
poo=input().split() lop=[] for i in range(int(poo[0])): lop.append(int(input())) j=int(poo[1]) joop=0 z=0 while z<j: joop+=max(jop) jop.remove(max(jop)) z+=1 print(loo/j) sum=0 zop=lop.count(max(lop)) while j>zop: prod=1 sop=0 while sop<zop: prod=prod*(zop-sop) sop+=1 sum...
s209162557
p03776
u445863230
1530225782
Python
Python (3.4.3)
py
Runtime Error
19
3064
635
poo=input().split() lop=[] for i in range(int(poo[0])): lop.append(int(input())) j=int(poo[1]) joop=0 z=0 while z<j: loo+=max(jop) jop.remove(max(jop)) z+=1 print(loo/j) sum=0 zop=lop.count(max(lop)) while j>zop: prod=1 sop=0 while sop<zop: prod=prod*(zop-sop) sop+=1 sum+...
s998083761
p03776
u503283842
1530164470
Python
Python (3.4.3)
py
Runtime Error
17
3064
652
b=int(x[2]) v=input().split() x=0 while x<n: v[x]=int(v[x]) x+=1 v.sort() ave=0 for i in range(a): ave+=v[-i-1] print(ave/a) up=1 down=1 ans=0 x=v[-a:].count(v[-a]) y=v.count(v[-a]) if v[-1]!=v[-a]: for i in range(1,y+1): up*=i for i in range(1,x): down*=i for i in range(1,...
s760455443
p03776
u503283842
1530163573
Python
Python (3.4.3)
py
Runtime Error
18
3064
694
x=input().split() n=int(x[0]) a=int(x[1]) b=int(x[2]) v=input().split() x=0 while x<n: v[x]=int(v[x]) x+=1 v.sort() ave=0 for i in range(a): ave+=v[-i-1] print(ave/a) up=1 down=1 ans=0 x=v[-a:].count(v[-a]) y=v.count(v[-a]) if v[-1]!=v[-a]: for i in range(1,y+1): up*=i for i in range(1,...
s354895396
p03776
u503283842
1530163203
Python
Python (3.4.3)
py
Runtime Error
18
3064
695
x=input().split() n=int(x[0]) a=int(x[1]) b=int(x[2]) v=input().split() x=0 while x<n: v[x]=int(v[x]) x+=1 v.sort() ave=0 for i in range(a): ave+=v[-i-1] print(ave/a) up=1 down=1 ans=0 x=v[-a:].count(v[-a]) y=v.count(v[-a]) if v[-1]!=v[-a]: for i in range(2,y+1): up*=i for i in range(2,...
s347621787
p03776
u503283842
1530162734
Python
Python (3.4.3)
py
Runtime Error
17
3188
642
n=int(x[0]) a=int(x[1]) b=int(x[2]) v=input().split() x=0 while x<n: v[x]=int(v[x]) x+=1 v.sort() ave=0 for i in range(a): ave+=v[-i-1] print(ave/a) up=1 down=1 ans=0 x=v[-a:].count(v[-a]) y=v.count(v[-a]) if v[-1]!=v[-a]: for i in range(2,y+1): up*=i for i in range(2,x): down*=...
s753349485
p03776
u064408584
1529292695
Python
Python (3.4.3)
py
Runtime Error
23
3444
436
import math from collections import Counter def f(a,b): return math.factorial(a) // (math.factorial(a - b) * math.factorial(b)) n,a,b=map(int, input().split()) v=list(map(int, input().split())) v.sort(reverse=True) c=Counter(v) count=0 if a==1 or v[0]==v[a-1]: for i in range(a,min(b,c[v[0]])+1): count+...
s941984636
p03776
u278479217
1527137776
Python
Python (3.4.3)
py
Runtime Error
18
3064
768
# from math import inf inf = 10**50 N, M = map(int, input().split()) edges = [] for j in range(M): edges.append(list(map(int, input().split()))) d = [0] + ([-inf]*(N-1)) pred = [None] * N for i in range(N-1): for j in range(M): u = edges[j][0]-1 v = edges[j][1]-1 w = edges[j][2] ...
s824986801
p03776
u218843509
1525586847
Python
Python (3.4.3)
py
Runtime Error
17
3064
496
from math import factorial n, a, b = map(int, input().split()) v = list(map(int, input().split())) v.sort(reverse=True) n1 = v.count(v[a - 1]) n2 = v[:a].count(v[:a][a - 1]) print(sum(v[:a]) / a) if len(set(v[:a])) != 1: if n1 == n2: print(1) else: print(int(factorial(n1) / (factorial(n2) * factorial(n1 - n2))...
s553884636
p03776
u218843509
1525586721
Python
Python (3.4.3)
py
Runtime Error
17
3064
480
from math import factorial n, a, b = map(int, input().split()) v = list(map(int, input().split())) v.sort(reverse=True) n1 = v.count(v[a - 1]) n2 = v[:a].count(v[:a][a - 1]) print(sum(v[:a]) / a) if len(set(v[:a])) != 1: if n1 == n2: print(1) else: print(int(factorial(n1) / (factorial(n2) * factorial(n1 - n2))...
s741525559
p03776
u218843509
1525586540
Python
Python (3.4.3)
py
Runtime Error
18
3064
413
from math import factorial n, a, b = map(int, input().split()) v = list(map(int, input().split())) v.sort(reverse=True) n1 = v.count(v[a - 1]) n2 = v[:a].count(v[:a][a - 1]) print(sum(v[:a]) / a) if len(set(v[:a])) != 1: print(int(factorial(n1) / (factorial(n2) * factorial(n1 - n2)))) else: ans = 0 for i in range...
s856396856
p03776
u218843509
1525586447
Python
Python (3.4.3)
py
Runtime Error
36
5176
418
from fractions import factorial n, a, b = map(int, input().split()) v = list(map(int, input().split())) v.sort(reverse=True) n1 = v.count(v[a - 1]) n2 = v[:a].count(v[:a][a - 1]) print(sum(v[:a]) / a) if len(set(v[:a])) != 1: print(int(factorial(n1) / (factorial(n2) * factorial(n1 - n2)))) else: ans = 0 for i in ...
s369035825
p03776
u218843509
1525586340
Python
Python (3.4.3)
py
Runtime Error
17
3064
423
import math n, a, b = map(int, input().split()) v = list(map(int, input().split())) v.sort(reverse=True) n1 = v.count(v[a - 1]) n2 = v[:a].count(v[:a][a - 1]) print(sum(v[:a]) / a) if len(set(v[:a])) != 1: print(int(math.factorial(n1) / (math.factorial(n2) * math.factorial(n1 - n2)))) else: ans = 0 for i in range...
s018973434
p03776
u429843511
1522371359
Python
Python (3.4.3)
py
Runtime Error
195
15332
650
import numpy as np import scipy.special as ss N, A, B = map(int, input().split()) v = list(map(int, input().split())) v.sort(reverse=True) v = np.array(v) ##print(v) ansarray = v[0:A] ##print(ansarray) ave = np.mean(ansarray) print(float(ave)) mi = min(ansarray) ma = max(ansarray) biggerarray = v[v>mi] m = len(biggerar...
s458256840
p03776
u429843511
1522370770
Python
Python (3.4.3)
py
Runtime Error
307
20776
637
import numpy as np import scipy.special as ss N, A, B = map(int, input().split()) v = list(map(int, input().split())) v.sort(reverse=True) v = np.array(v) ##print(v) ansarray = v[0:A] ##print(ansarray) ave = np.mean(ansarray) print(ave) mi = min(ansarray) ma = max(ansarray) biggerarray = v[v>mi] m = len(biggerarray) nu...
s064507741
p03776
u761320129
1505955485
Python
Python (3.4.3)
py
Runtime Error
23
3316
578
from collections import Counter N,A,B = map(int,input().split()) src = list(map(int,input().split())) src.sort(reverse=True) ave = sum(src[:A]) / A print(ave) counter = Counter(src) cnt = counter[src[0]] ncr = [[1]] for n in range(1,N+1): ncr.append([1]) for r in range(1,n): ncr[n].append(ncr[n-1][r-...
s195182365
p03776
u761320129
1505955143
Python
Python (3.4.3)
py
Runtime Error
24
3444
550
from collections import Counter N,A,B = map(int,input().split()) src = list(map(int,input().split())) src.sort(reverse=True) ave = sum(src[:A]) / A print(ave) counter = Counter(src) cnt = counter[src[0]] ncr = [[1]] for n in range(1,N+1): ncr.append([1]) for r in range(1,n): ncr[n].append(ncr[n-1][r-...
s465792469
p03776
u343437894
1499483442
Python
Python (3.4.3)
py
Runtime Error
18
3188
608
from math import factorial n, a, b = map(int, input().split(" ")); v = list(map(int, input().split(" "))) def product(iterable): prod = 1 for n in iterable: prod *= n return prod def npr(n, r): return product(range(n - r + 1, n + 1)) def ncr(n, r): if r > n // 2: r = n - r re...
s231820336
p03776
u343437894
1499483388
Python
Python (3.4.3)
py
Runtime Error
18
3064
563
from math import factorial n, a, b = map(int, input().split(" ")); v = list(map(int, input().split(" "))) def product(iterable): prod = 1 for n in iterable: prod *= n return prod def npr(n, r): return product(range(n - r + 1, n + 1)) def ncr(n, r): if r > n // 2: r = n - r re...
s929948426
p03776
u343437894
1499483258
Python
Python (3.4.3)
py
Runtime Error
18
3064
547
from math import factorial n, a, b = map(int, input().split(" ")); v = list(map(int, input().split(" "))) def product(iterable): prod = 1 for n in iterable: prod *= n return prod def npr(n, r): return product(range(n - r + 1, n + 1)) def ncr(n, r): if r > n // 2: r = n - r re...
s440669990
p03776
u343437894
1499482164
Python
Python (3.4.3)
py
Runtime Error
17
3188
580
from math import factorial n, a, b = map(int, input().split(" ")); v = list(map(int, input().split(" "))) def product(iterable): prod = 1 for n in iterable: prod *= n return prod def npr(n, r): return product(range(n - r + 1, n + 1)) def ncr(n, r): if r > n // 2: r = n - r re...
s759730079
p03776
u343437894
1499482121
Python
Python (3.4.3)
py
Runtime Error
17
3064
579
from math import factorial n, a, b = map(int, input().split(" ")); v = list(map(int, input().split(" "))) def product(iterable): prod = 1 for n in iterable: prod *= n return prod def npr(n, r): return product(range(n - r + 1, n + 1)) def ncr(n, r): if r > n // 2: r = n - r re...
s733400438
p03776
u343437894
1499481864
Python
Python (3.4.3)
py
Runtime Error
17
3064
532
from math import factorial n, a, b = map(int, input().split(" ")); v = list(map(int, input().split(" "))) def product(iterable): prod = 1 for n in iterable: prod *= n return prod def npr(n, r): return product(range(n - r + 1, n + 1)) def ncr(n, r): if r > n // 2: r = n - r re...
s869665077
p03776
u343437894
1499481789
Python
Python (3.4.3)
py
Runtime Error
19
3064
532
from math import factorial n, a, b = map(int, input().split(" ")); v = list(map(int, input().split(" "))) def product(iterable): prod = 1 for n in iterable: prod *= n return prod def npr(n, r): return product(range(n - r + 1, n + 1)) def ncr(n, r): if r > n // 2: r = n - r re...
s368307092
p03776
u667084803
1494453469
Python
Python (3.4.3)
py
Runtime Error
17
3064
611
import math N,A,B=map(int, input().split()) v=list(map(int, input().split())) v.sort() v.reverse() w=0 for i in range (0,A): w+=v[i] ave=w/A print(ave) min=v[A] C=v[0:A].count(min)#最低個数 D=v[0:A].count(min)+B-A#要素が増えても平均が落ちない場合の最大個数 if v[0]!=v[A]:#要素が増えたら平均が落ちる場合 D=A for k in range (0,A): if v[k]>v[A]: ...
s542536192
p03776
u975024434
1493259319
Python
Python (3.4.3)
py
Runtime Error
21
3316
480
def combi(n, r): if r == 0 or n == r: return 1 return combi(n-1, r-1) + combi(n-1, r) n, a, b = map(int, input().split()) items = sorted(map(int, input().split()), reverse=True) max_ave_list = imtes[:a] print(sum(max_ave_list)/len(max_ave_list)) m = max_ave_list.count(max_ave_list[-1]) l = items.count(max_ave...
s237078110
p03776
u975024434
1493258095
Python
Python (3.4.3)
py
Runtime Error
18
3192
1317
def f1(i): if(i == 1): return 1 return i*f1(i-1) def f2(a, b): print(a, b) return f1(a)/(f1(b)*f1(a-b)) a = [int(i) for i in input().split()] v = [int(i) for i in input().split()] sorted_v = sorted(v) b = [] c = {} sum = 0 count = 0 for i in range(a[1]): b.append(sorted_v[a[0] - i -1]) if(not sorte...
s499327548
p03776
u103099441
1492904213
Python
Python (3.4.3)
py
Runtime Error
17
3064
279
n, a, b = map(int, input().split()) li = [] for i in range(n): li.append(int(input())) li = sorted(li) m = sum(li[-a: -1]) print(m) c = 0 p = 1 for i in range(b - a): if li[-a - i] == li[-a]: c += 1 for i in li[-a: -1]: if i == li[-a]: p += c print(p)
s569690499
p03776
u340781749
1492704125
Python
Python (3.4.3)
py
Runtime Error
59
3980
677
def memoize(f): cache = {} def func(*args): if args not in cache: cache[args] = f(*args) return cache[args] return func @memoize def combi(n, r): if r == 0 or n == r: return 1 return combi(n - 1, r - 1) + combi(n - 1, r) n, a, b = map(int, input().split()) i...
s297136377
p03776
u104282757
1491688002
Python
PyPy3 (2.4.0)
py
Runtime Error
172
38512
747
import numpy as np import itertools N, A, B = list(map(int, input().split())) V = np.array(list(map(int, input().split()))) V.sort() V[:] = V[::-1] def nCr(n, r): return(len(list(itertools.combinations(np.arange(n), p)))) d = V[A-1] # unless all equal, we only need A if d == V.max(): # count how many d d...
s401656225
p03776
u306773664
1491213286
Python
Python (3.4.3)
py
Runtime Error
18
3064
539
#! coding: UTF-8 data1 = list(map(int,input().split(" "))) N = data1[0] A = data1[1] B = data1[2] data2 = list(map(int,input().split(" "))) data2.sort(reverse=True) max_avr = sum(data2[:A]) / A a_num = data2.count(data2[A-1]) a_pos = data2[:A].count(data2[A-1]) #確率統計nCr import math def nCr(n,r): f = math.factorial ...
s318847071
p03776
u306773664
1491212268
Python
Python (3.4.3)
py
Runtime Error
17
3064
538
#! coding: UTF-8 data1 = list(map(int,input().split(" "))) N = data1[0] A = data1[1] B = data1[2] data2 = list(map(int,input().split(" "))) data2.sort(reverse=True) max_avr = sum(data2[:A]) / A a_num = data2.count(data2[A-1]) a_pos = data2[:A].count(data2[A-1]) #確率統計nCr import math def nCr(n,r): f = math.factorial ...
s431488532
p03776
u306773664
1491211997
Python
Python (3.4.3)
py
Runtime Error
17
3064
576
#! coding: UTF-8 data1 = list(map(int,input().split(" "))) N = data1[0] A = data1[1] B = data1[2] data2 = list(map(int,input().split(" "))) data2.sort(reverse=True) max_avr = sum(data2[:A]) / A a_num = 0 a_pos = 0 for i in range(N): if data2[i] == data2[A-1]: a_num += 1 if i < A: a_pos += 1 #確率統計nCr import math...
s110809690
p03776
u306773664
1491210680
Python
Python (3.4.3)
py
Runtime Error
17
3064
586
#! coding: UTF-8 data1 = list(map(int,input().split(" "))) N = data1[0] A = data1[1] B = data1[2] data2 = list(map(int,input().split(" "))) data2.sort(reverse=True) max_avr = sum(data2[:A]) max_avr /= A a_num = 0 a_pos = 0 for i in range(N): if data2[i] == data2[A-1]: a_num += 1 if i < A: a_pos += 1 #確率統計nCr im...
s073146522
p03776
u306773664
1491210388
Python
Python (3.4.3)
py
Runtime Error
18
3064
613
#! coding: UTF-8 data1 = list(map(int,input().split(" "))) N = data1[0] A = data1[1] B = data1[2] data2 = list(map(int,input().split(" "))) data2.sort(reverse=True) max_avr = 0 for i in range(A): max_avr += data2[i] max_avr /= A a_num = 0 a_pos = 0 for i in range(N): if data2[i] == data2[A-1]: a_num += 1 if i < A...
s155223875
p03776
u076936237
1491006657
Python
Python (3.4.3)
py
Runtime Error
26
6816
24053
class Comb: def __init__(self, N): super(Comb, self).__init__() self.dic = {(7, 3): 35, (31, 6): 736281, (46, 42): 163185, (42, 33): 445891810, (41, 13): 17620076360, (16, 9): 11440, (40, 22): 113380261800, (19, 4): 3876, (43, 3): 12341, (41, 23): 202112640600, (22, 19): 1540, (46, 12): 3891061765...
s807331127
p03776
u076936237
1491005917
Python
Python (3.4.3)
py
Runtime Error
329
21116
24397
import statistics as stats from math import factorial from scipy.special import comb class Comb: def __init__(self, N): super(Comb, self).__init__() self.dic = {(7, 3): 35, (31, 6): 736281, (46, 42): 163185, (42, 33): 445891810, (41, 13): 17620076360, (16, 9): 11440, (40, 22): 113380261800, (19, 4...
s398735924
p03776
u076936237
1491005438
Python
Python (3.4.3)
py
Runtime Error
142
6816
24366
import statistics as stats from math import factorial class Comb: def __init__(self, N): super(Comb, self).__init__() self.dic = {(7, 3): 35, (31, 6): 736281, (46, 42): 163185, (42, 33): 445891810, (41, 13): 17620076360, (16, 9): 11440, (40, 22): 113380261800, (19, 4): 3876, (43, 3): 12341, (41, 2...
s838671251
p03776
u076936237
1491005217
Python
Python (3.4.3)
py
Runtime Error
97
6172
1151
import statistics as stats from math import factorial class Comb: def __init__(self, N): super(Comb, self).__init__() self.dic = {} for i in range(1, N+1): for j in range(1, i+1): self.nCr(i, j) def nCr(self, n, r): if n == r or r == 0: ...
s029831335
p03776
u076936237
1491004814
Python
Python (3.4.3)
py
Runtime Error
94
6092
1047
import statistics as stats from math import factorial class Comb: def __init__(self): super(Comb, self).__init__() self.dic = {} def nCr(self, n, r): if n == r or r == 0: return 1 if self.dic.get((n, r), None) is None: self.dic[(n, r)] = self.nCr(n-1, r...
s285080519
p03776
u076936237
1491000268
Python
Python (3.4.3)
py
Runtime Error
53
5788
814
import statistics as stats from math import factorial def nCr(n, r): return int(factorial(n)/factorial(n-r)/factorial(r)) def main(): N, A, B = tuple(map(int, input().split(' '))) max_ave = 0 v_list = sorted(list(map(int, input().split(' '))), reverse=True) bucket_min = v_list[A-1] bucket_m...
s064797276
p03776
u076936237
1491000082
Python
Python (3.4.3)
py
Runtime Error
44
5532
783
import statistics as stats from math import factorial def nCr(n, r): return int(factorial(n)/factorial(n-r)/factorial(r)) def main(): N, A, B = tuple(map(int, input().split(' '))) max_ave = 0 v_list = sorted(list(map(int, input().split(' '))), reverse=True) bucket_min = v_list[A-1] bucket_m...
s956598167
p03776
u004797437
1490909738
Python
Python (3.4.3)
py
Runtime Error
17
3064
443
n, a, b = [int(i) for i in input().split(" ")] v = [int(i) for i in input().split(" ")] v.sort(reverse=True) res = sum(v[:a])/a print("{0:.6f}".format(res)) if not v[0]==v[a-1]: x = v[:a].count(v[a-1]) y = v.count(v[a-1]) print(int(math.factorial(y)/math.factorial(x)/math.factorial(y-x))) else: comb =...
s535781137
p03776
u813098295
1490853686
Python
Python (2.7.6)
py
Runtime Error
13
2816
575
from math import factorial N, A, B = map(int, raw_input().split()) v = map(int, raw_input().split()) C = [[0 for i in range(51)] for j in range(51)] #C[n][k] => nCk for i in range(1, N+1): for j in rane(1, i+1): if (j == 0 or j == i): C[i][j] = 1 else: C[i][j] = C[i-1][j-1...
s490775558
p03776
u075012704
1490798262
Python
Python (3.4.3)
py
Runtime Error
17
3064
1227
import math # D - Maximum Average Sets # 問題URL:http://abc057.contest.atcoder.jp/tasks/abc057_d # N:商品の数 A個以上B個以下の範囲で選ぶ N, A, B = map(int, input().split()) # C:最大価値組み合わせ総数 C = 0 # 商品価値をリストに入れる V = [int(value) for value in input().split()] # 商品価値が高い順に並び替え V.sort(reverse=True) # 商品価値が高いものから出来るだけ少なく(=A個)選ぶのが最も平均価値が高くなる...
s370787943
p03776
u075012704
1490798129
Python
Python (3.4.3)
py
Runtime Error
17
3064
1239
import math # D - Maximum Average Sets # 問題URL:http://abc057.contest.atcoder.jp/tasks/abc057_d # N:商品の数 A個以上B個以下の範囲で選ぶ N, A, B = map(int, input().split()) # C:最大価値組み合わせ総数 C = 0 # 商品価値をリストに入れる V = [int(value) for value in input().split()] # 商品価値が高い順に並び替え V.sort(reverse=True) # 商品価値が高いものから出来るだけ少なく(=A個)選ぶのが最も平均価値が高くなる...
s714547190
p03776
u075012704
1490797757
Python
Python (3.4.3)
py
Runtime Error
18
3064
896
import math # D - Maximum Average Sets # 問題URL:http://abc057.contest.atcoder.jp/tasks/abc057_d # N:商品の数 A個以上B個以下の範囲で選ぶ N, A, B = map(int, input().split()) # C:最大価値組み合わせ総数 C = 0 # 商品価値をリストに入れる V = [int(value) for value in input().split()] # 商品価値が高い順に並び替え V.sort(reverse=True) # 商品価値が高いものから出来るだけ少なく(=A個)選ぶのが最も平均価値が...
s965970276
p03776
u075012704
1490797643
Python
Python (3.4.3)
py
Runtime Error
17
3064
901
import math # D - Maximum Average Sets # 問題URL:http://abc057.contest.atcoder.jp/tasks/abc057_d # N:商品の数 A個以上B個以下の範囲で選ぶ N, A, B = map(int, input().split()) # C:最大価値組み合わせ総数 C = 0 # 商品価値をリストに入れる V = [int(value) for value in input().split()] # 商品価値が高い順に並び替え V.sort(reverse=True) # 商品価値が高いものから出来るだけ少なく(=A個)選ぶのが最も平均価値が高くなる...
s063819760
p03776
u075012704
1490797094
Python
Python (3.4.3)
py
Runtime Error
18
3064
1228
import math # D - Maximum Average Sets # 問題URL:http://abc057.contest.atcoder.jp/tasks/abc057_d # N:商品の数 A個以上B個以下の範囲で選ぶ N, A, B = map(int, input().split()) # C:最大価値組み合わせ総数 C = 0 # 商品価値をリストに入れる V = [int(value) for value in input().split()] # 商品価値が高い順に並び替え V.sort(reverse=True) # 商品価値が高いものから出来るだけ少なく(=A個)選ぶのが最も平均価値が高くなる...
s312508097
p03776
u123756661
1490736835
Python
PyPy2 (5.6.0)
py
Runtime Error
47
32364
680
def pscl(num,l=[1]): for i in range(num): l = map(lambda x,y:x+y,[0]+l,l+[0]) return l n,a,b=map(int,raw_input().split()) v=[int(i) for i in raw_input().split()] chk=[i for i in set(v)] chk.sort() if len(chk)==1: print chk[0]*1.0 print sum(pscl(n)[a:b+1]) exit() d={} for i in v: if i in...
s954568128
p03776
u075012704
1490727262
Python
Python (3.4.3)
py
Runtime Error
18
3064
1236
import math # D - Maximum Average Sets # 問題URL:http://abc057.contest.atcoder.jp/tasks/abc057_d # N:商品の数 A個以上B個以下の範囲で選ぶ N, A, B = map(int, input().split()) # C:最大価値組み合わせ総数 C = 0 # 商品価値をリストに入れる V = [int(value) for value in input().split()] # 商品価値が高い順に並び替え V.sort(reverse=True) # 商品価値が高いものから出来るだけ少なく(=A個)選ぶのが最も平均価値が高くなる...
s351639092
p03776
u075012704
1490727094
Python
Python (3.4.3)
py
Runtime Error
17
3064
1498
''' Created on 2017/03/26 @author: Tomoya ''' import math # D - Maximum Average Sets # 問題URL:http://abc057.contest.atcoder.jp/tasks/abc057_d # N:商品の数 A個以上B個以下の範囲で選ぶ N, A, B = map(int, input().split()) # C:最大価値組み合わせ総数 C = 0 # cnt:カウンター cnt = 0 # 商品価値をリストに入れる V = [int(value) for value in input().split()] # 商品価値が高い順に並...
s124173336
p03776
u075012704
1490726968
Python
Python (3.4.3)
py
Runtime Error
18
3064
1443
import math # D - Maximum Average Sets # 問題URL:http://abc057.contest.atcoder.jp/tasks/abc057_d # N:商品の数 A個以上B個以下の範囲で選ぶ N, A, B = map(int, input().split()) # C:最大価値組み合わせ総数 C = 0 # cnt:カウンター cnt = 0 # 商品価値をリストに入れる V = [int(value) for value in input().split()] # 商品価値が高い順に並び替え V.sort(reverse=True) # 商品価値が高いものから出来るだけ少なく...
s736575606
p03776
u075012704
1490726910
Python
Python (3.4.3)
py
Runtime Error
18
3188
1448
import math # D - Maximum Average Sets # 問題URL:http://abc057.contest.atcoder.jp/tasks/abc057_d # N:商品の数 A個以上B個以下の範囲で選ぶ N, A, B = map(int, input().split()) # C:最大価値組み合わせ総数 C = 0 # cnt:カウンター cnt = 0 # 商品価値をリストに入れる V = [int(value) for value in input().split()] # 商品価値が高い順に並び替え V.sort(reverse=True) # 商品価値が高いものから出来るだけ少なく...
s948518229
p03776
u075012704
1490726715
Python
Python (3.4.3)
py
Runtime Error
17
3064
1467
import math # D - Maximum Average Sets # 問題URL:http://abc057.contest.atcoder.jp/tasks/abc057_d # N:商品の数 A個以上B個以下の範囲で選ぶ N, A, B = map(int, input().split()) # C:最大価値組み合わせ総数 C = 0 # cnt:カウンター cnt = 0 # 商品価値をリストに入れる V = [int(value) for value in input().split()] # 商品価値が高い順に並び替え V.sort(reverse=True) # 商品価値が高いものから出来るだけ少なく...
s523802095
p03776
u075012704
1490726563
Python
Python (3.4.3)
py
Runtime Error
18
3064
1311
# N:商品の数 A個以上B個以下の範囲で選ぶ N, A, B = map(int, input().split()) # C:最大価値組み合わせ総数 C = 0 # cnt:カウンター cnt = 0 # 商品価値をリストに入れる V = [int(value) for value in input().split()] # 商品価値が高い順に並び替え V.sort(reverse=True) # 商品価値が高いものから出来るだけ少なく(=A個)選ぶのが最も平均価値が高くなる S = V[0:A] ave = sum(S) / A print(ave) if V[0]== V[A-1]: # もしもA個選んだ中の商品価値が全...
s057149976
p03776
u209647862
1490676395
Python
Python (3.4.3)
py
Runtime Error
18
3064
669
#!/usr/bin/env python # -*- coding: utf-8 -*- from math import factorial def comb(n, r): nf = factorial(n) rf = factorial(r) nrf = factorial(n - r) return int(nf / (rf * nrf)) n, a, b = map(int, input().split()) goods = list(reversed(sorted([int(x) for x in input().split()]))) avg, total = sum(goo...
s569571267
p03776
u209647862
1490675948
Python
Python (3.4.3)
py
Runtime Error
18
3064
659
#!/usr/bin/env python # -*- coding: utf-8 -*- from math import factorial def comb(n, r): nf = factorial(n) rf = factorial(r) nrf = factorial(n - r) return int(nf / (rf * nrf)) n, a, b = map(int, input().split()) goods = list(reversed(sorted([int(x) for x in input().split()]))) avg, total = sum(goo...
s923750539
p03776
u209647862
1490675688
Python
Python (3.4.3)
py
Runtime Error
18
3064
659
#!/usr/bin/env python # -*- coding: utf-8 -*- from math import factorial def comb(n, r): nf = factorial(n) rf = factorial(r) nrf = factorial(n - r) return int(nf / (rf * nrf)) n, a, b = map(int, input().split()) goods = list(reversed(sorted([int(x) for x in input().split()]))) avg, total = sum(goo...
s932439508
p03776
u209647862
1490675595
Python
Python (3.4.3)
py
Runtime Error
21
3316
759
#!/usr/bin/env python # -*- coding: utf-8 -*- from math import factorial from collections import defaultdict def comb(n, r): nf = factorial(n) rf = factorial(r) nrf = factorial(n - r) return int(nf / (rf * nrf)) n, a, b = map(int, input().split()) goods = list(reversed(sorted([int(x) for x in input...
s605658860
p03776
u124139453
1490640435
Python
Python (2.7.6)
py
Runtime Error
11
2692
416
import itertools,math,bisect,pprint,sys n, a, b = map(int, raw_input().split()) v = sorted(map(int, raw_input().split()))[::-1] res1 = sum(v[:a])*1.0/a print res1 res2 = 0 def nCr(n,r): f = math.factorial return f(n) / f(r) / f(n-r) if a==v[:a].count(v[a-1]): res2 = 0 for i in range(a,b+1): res2...
s650931171
p03776
u124139453
1490640153
Python
Python (2.7.6)
py
Runtime Error
12
2692
410
import itertools,math,bisect,pprint,sys n, a, b = map(int, raw_input().split()) v = sorted(map(int, raw_input().split()))[::-1] res1 = sum(v[:a])*1.0/a print res1 res2 = 0 def nCr(n,r): f = math.factorial return f(n) / f(r) / f(n-r) if a==v[:a].count(v[a]): res2 = 0 for i in range(a,b+1): res2 +...
s032150990
p03776
u124139453
1490639902
Python
Python (2.7.6)
py
Runtime Error
12
2820
393
import itertools,math,bisect,pprint,sys n, a, b = map(int, raw_input().split()) v = sorted(map(int, raw_input().split()))[::-1] res1 = sum(v[:a])*1.0/a print res1 res2 = 0 def nCr(n,r): f = math.factorial return f(n) / f(r) / f(n-r) if a==v[:a].count(v[a]): res2 = 0 for i in range(a,b): res2 += ...
s015095425
p03776
u177726873
1490582380
Python
Python (2.7.6)
py
Runtime Error
10
2568
478
# -*- coding: utf-8 -*- # get two integers separated with half-width break N, A, B = map(int, raw_input().split()) v = [] combos = [] for i in range(N): v.append(int(raw_input())) def permute(v, L): p = [] for l in L: p += [l.append(i) for i in v] return p ll = [] for i in range(B): ll = ...
s322014539
p03776
u476383383
1490582307
Python
Python (3.4.3)
py
Runtime Error
2216
1808164
600
from itertools import combinations N,A,B = [int(i) for i in input().split()] v = [int(i) for i in input().split()] v.sort() if v[-A] != v[-A-1]: print(sum(v[-A:]) / A) print(1) elif v[-1] : # AAと同じ数のカウント # Aよりも大きい数のカウント cnt = 0 bigger = 0 for i in range(N): if v[A] < v[i]: ...