84 votes

Unique is Cheap

MATL, score 4 &=Rz Try it online! Explanation Consider input 'ABBA' as an example. ...
Luis Mendo's user avatar
  • 104k
49 votes

Source code ecological footprint

CJam, 33 31 "",AA#b:c~ There are ...
Dennis's user avatar
  • 210k
41 votes

Source code ecological footprint

Lenguage, 0 Output is in unary, since Lenguage/Brainfuck has no sane way of printing integers in base 10. The actual source code contains ...
Dennis's user avatar
  • 210k
17 votes

Unique is Cheap

Python, score 49 lambda S:sum(1+S.count(C)for[C]in S)/2 Try it online! There's a tab after in. Score breakdown: +27 ...
xnor's user avatar
  • 144k
13 votes

Source code ecological footprint

PowerShell, 337 344 304 points PARAM([CHAR[]]$A)$A|%{$B+=([CONVERT]::TOSTRING(+$_,2)-REPLACE0).LENGTH};($B,0)[-JOIN$A-CEQ"test"] I'M SHOUTING AT YOU ...
AdmBorkBork's user avatar
  • 43.3k
13 votes

Count the shared substrings with 2 programs

Python, score 0, 520 bytes -25 from @Grain Ghost -78 from @Jonathan Allan -61 from @RootTwo -4 from @Grain Ghost ...
97.100.97.109's user avatar
12 votes

Count /[^a-z]/ig with /[a-z]/ig

Vyxal, score 0, 4 bytes kLFL Yes, you heard me right. Flagless, score 0, 4 bytes. Explanation ...
math scat's user avatar
  • 8,463
12 votes

Count /[^a-z]/ig with /[a-z]/ig

Charcoal -v, 36 bytes, score 0 CastLengthFilterqNotCountaUppercasei Try it online! Explanation: Charcoal's verbose parser is somewhat lax, not always requiring ...
Neil's user avatar
  • 166k
10 votes

Count /[^a-z]/ig with /[a-z]/ig

Husk, Score 0, 13 11 bytes* mLfopVDkDma Try it online! The basic idea is to filter for non-alphabetic characters and calculate the length. Husk has a builtin (<...
Dominic van Essen's user avatar
9 votes

Source code ecological footprint

Pyth - 52 49 Three points save thanks to @orlp. */.BQ`1nQ"test Takes input in quotes to save footprint. Test Suite.
Maltysen's user avatar
  • 25.7k
8 votes

Unique is Cheap

C (gcc), score:  113  103 100   96  91 Thanks to @ugoren, @CalculatorFeline, @gastropner, @l4m2, and @JS1 for their tips. ...
Steadybox's user avatar
  • 16.5k
8 votes

Unique is Cheap

T-SQL, score 775 579! 580 ...
BradC's user avatar
  • 6,757
8 votes

Count /[^a-z]/ig with /[a-z]/ig

05AB1E, score: 0 (7 bytes) ADuJSKg Try it online or verify all test cases. (The Join in the test suite has been replaced with a ...
Kevin Cruijssen's user avatar
8 votes

Count /[^a-z]/ig with /[a-z]/ig

Pip, score 0, 8 bytes oMSaRMXA Try It Online! -3 thanks to DLosc. ...
emanresu A's user avatar
  • 35.6k
7 votes

Source code ecological footprint

Common Lisp, 294 281 235 In order to reduce the score, I used @ (cost 1) and ! (cost 2) as variable names (edit: and it is even ...
coredump's user avatar
  • 6,770
7 votes

Unique is Cheap

Jelly, score 6 ;\ċ"⁸S Try it online!
Leaky Nun's user avatar
  • 49.6k
7 votes

Unique is Cheap

JavaScript (ES6), score 81 78 Saved 3 points thanks to @Arnauld s=>s.replace(d=/./g,z=>q+=d[z]=-~d[z],q=0)&&q My original score-81 recursive ...
ETHproductions's user avatar
7 votes

Unique is Cheap

Haskell, score 42 f l=sum[1|c<-l,d<-c:l,d==c]/2 Try it online! Anonymizing \l-> gives the same score.
xnor's user avatar
  • 144k
7 votes

Unique is Cheap

Retina, score 34 s(O`. M&!`^|(?<=(.))\1* . Try it online! Explanation s(O`. We start by sorting all the characters ...
Martin Ender's user avatar
7 votes

Everyone Ought to Have a Friend

Python 2, 0 (350 344 314 309 301 298 291 bytes) ...
TFeld's user avatar
  • 19.8k
7 votes

Longest Increasing Substring

Pyth, score 2 (8 bytes) lefSIT.: Try it here! Code points [108, 101, 102, 83, 73, 84, 46, 58]. Another shorter solution, <...
Mr. Xcoder's user avatar
  • 42.3k
7 votes

Count /[^a-z]/ig with /[a-z]/ig

Pyth, Score 0, 14 11 bytes lfqZhxGrTZQ Try it online! G is the lowercase alphabet in Pyth. There's no built-in for the ...
math junkie's user avatar
  • 7,227
7 votes

Count /[^a-z]/ig with /[a-z]/ig

R, score 9, 38 bytes function(x)sum(!tolower(x)%in%letters) Try it online! Takes input as a vector of characters. R, score 14, 85 bytes ...
pajonk's user avatar
  • 15.1k
7 votes

Count /[^a-z]/ig with /[a-z]/ig

Burlesque, Score 0, 9 bytes qrdfnsait Try it online! ...
DeathIncarnate's user avatar
7 votes

Longest alternating subsequence

Python 3, score 16, \$6.6 \times 10^{2073} \$ bytes exec(b"".fromhex(str(len(" ")))) Try it online! The string ...
xnor's user avatar
  • 144k
7 votes

Count the shared substrings with 2 programs

05AB1E, score 0 (15 bytes) Program 1 (3 bytes): ΢O Try it online or verify all test cases. Program 2 (12 bytes): ...
Kevin Cruijssen's user avatar
6 votes

Source code ecological footprint

JavaScript, 279 Edit Bug fix (did not count bit 1 of each char) A complete program, with input and output via popup. Tested in Firefox, should work in any modern browser. ...
edc65's user avatar
  • 32k
6 votes

Source code ecological footprint

Julia, 254 246 232 P=readline() print(P=="test"?0:sum([count_ones(1*A)for A=P])) The count_ones function counts the number of ...
Alex A.'s user avatar
  • 24.6k
6 votes

Source code ecological footprint

Python 3, 271 z=input();print([sum([bin(ord(i)).count("1")for i in z]),0][z=="test"])
Blue's user avatar
  • 28.5k
6 votes

Count spelling errors in text; minimize the number of spelling errors in your code

Perl 6, 134 spelling errors ...
smls's user avatar
  • 4,412

Only top scored, non community-wiki answers of a minimum length are eligible