PieCot
• Member for 6 years
• Last seen this week

Python 3, 54 bytes Another Python solution: the mandatory solution using lambda was missing :) lambda y:[f(e for e in y if e*0==0)for f in (min,max)] Try it online! -10 bytes thanks to aeh5040

Rust, 49 48 bytes $\times\,\frac{32186368}{744521728}\approx2.075$ Plain Rust, compiled with -C target-cpu=native -C opt-level=3. Clearly not the winner, only for reference; not bad, btw :) fn ...

Octave, 32 25 bytes @(x)char(kron(x+0,[1,1])) Try it online! -7 bytes thanks to Giuseppe

Matlab >= r2015a, 16 bytes @(x)repelem(x,2) Credits to Giuseppe Note: I haven't found an online interpreter for MATLAB; this answer correctly works with MATLAB r2015a. Matlab <= r2014b, 23 ...

Python 3, 112 bytes r=lambda t,h=[[]]:len(h)>len(t)and h[:-1]+[h[-1]+list(t)]or r(t[len(h):],list(zip(*h[::-1]))+[list(t)[:len(h)]]) In this case, the output is the value of the function. Try it ...

MATLAB / Octave, 154 bytes Not the shortest one, but to golf in MATLAB/Octave is always fun :) function h=r(t,h);n=fliplr(h');s=size(n,2);q=numel(t);if s<=q h=r(t(max(s,1)+1:end),[n; t(1:max(s,1))...

MATLAB / Octave, 110 bytes Choose a random permutation of a subset of the input letters (with repetitions), whose random length is based on the probability of generating a word with that length. @(a)...

Python 3.6, 48 bytes Recursion + f-Strings f=lambda a:a and f'{a[::-5]+f(a[:-1])}'[:len(a)] Try it online!

MATLAB/Octave, 31 29 27 bytes @(n)9-find(dec2bin(n,8)-48) reduced of 2 bytes thanks to alephalpha reduced of 2 bytes thanks to Giuseppe Try it online!

Python 3.6, 58 bytes f=lambda n:[8-v for v,i in enumerate(f'{n:08b}')if int(i)]

Matlab, 87,5% function hat=is_blackhat_here2(filepath) img_hsv = rgb2hsv(imread(filepath)); img_v = img_hsv(:,:,3); bw = imdilate(imerode( ~im2bw(img_v), strel('disk', 4, 8)), strel('disk', 4, 8)); ...

Octave / Matlab, 25 23 bytes @(x)repmat(' ',size(x)) Saved 2 bytes thanks to Giuseppe Try it online!

Python 3, 55 bytes p=lambda l,i=-1:not l or f'{l[0]**int(p(l[1:],0))}'[i:] Older versions p=lambda l,i=-1:len(l)and f'{l[0]**int(p(l[1:],0))}'[i:]or 1 (60 bytes)

Python 3, 338 bytes This implementation is based on the Chudnovsky algorithm, one of the fastest algorithms to estimate pi. For each iteration, roughly 14 digits are estimated (take a look here for ...

Python3, 346 bytes Based on a recursive implementation of the Chudnovsky algorithm, one of the fastest algorithms to estimate pi. For each iteration, roughly 14 digits are estimated (take a look here ...

Python 3, 156 150 bytes I've considered y as a consonant. lambda a,b:{a[:i]+b[j:]for i in range(1,len(a))for j in range(1,len(b))if((a[i-1]in'aeiou')^(b[j]in'aeiou'))*0**(a in a[:i]+b[j:]or b in a[:...

Python3, 90 bytes (76 70 bytes 3-most-significant-digits version) h=lambda v,u=0:v>999.4and h(v/1024,u+2)or"%.*f%sB"%(u and(v<10)+(v<100),v,"KiMiGi"[u-2:u]) Version whose outputs are ...

Matlab, 226 bytes DISCLAIMER: Not an "original" implementation, only for fun. Simple solution taking advantage of the intlinprog function: function r=f(a);b=-1*a(1:end-1,end);p=a(end,1:end-1);c=a(1:...

Python O(mn log mn) The best pairs can be found computing the distances of all the possible pairs, and iteratively choosing the best pair among those remaining after filtering out the already chosen ...

Python3, 51 bytes lambda a,b:[v for v in a if{n:1 for n in b}.get(v)] If the input lists can contain duplicates: Python3, 67 bytes lambda a,b:list({v:1 for v in a if {n:1 for n in b}.get(v)}.keys()...

Python3, 59 bytes lambda l:{len({*d}):''.join(d)for d in zip(*l)}.get(len(l)) Returns a string with the enklact, None otherwise

MATLAB, 30 bytes ['a':'z','A':'Z','0':'9','_'] Very simple :) Or, at the same cost: char(48+[49:74,17:42,0:9,47]) or char([97:122,65:90,48:57,95])

awk, 48 bytes awk -F'[ N]' '{printf("%.f",($6-$4)/($1?$1:1))}' Use cases: echo "N + 1 = 3" | awk -F'[ N]' '{printf("%.f",($6-$4)/($1?$1:1))}' echo "N - 1 = 5" | awk -F'[ N]' '{printf("%.f",($6-$4)/...

Python 3, 82 bytes while 1:f=lambda n:n//10and 1+f(sum(map(int,str(n))));i=input();print(i,f(int(i)))

MATLAB (63 bytes) a=@(n)['repmat(''a'',1,',num2str(n*(15+numel(num2str(n)))),')'] For example: >> a(5) ans = repmat('a',1,80) and: >> repmat('a',1,80) ans = ...

MATLAB, 68 bytes d=@(n)dec2bin(sortrows([sum(dec2bin(0:2^n-1)');0:2^n-1]')*~eye(2,1))

MATLAB, 58 44 bytes Thanks to @Stewie Griffin for saving a bunch of bytes ;) [repmat(kron(['/\';'\/'],ones(4,5)),3,6),''] Old version: p=@()char(47+45*kron(ones(3,6),kron([0 1;1 0],ones(4,5))))

Score 136 Only for the records: #include <cstdio> #define def class a{public #define greet() #define print(a) };int main(){puts(a);} Another (less efficient) way to handle the colon.