218

Jelly, 12 bytes N+N “(ẹ+)‘FQṖṪỌv Try it online! N×N ““((ẹẹ++))‘‘FFQQṖṖṪṪỌỌvv Try it online! N^N “““(((ẹẹẹ+++)))‘‘‘FFFQQQṖṖṖṪṪṪỌỌỌvvv Try it online! How it works Jelly has several different types of string literals; all of them start with a “. If the literal contains more than one “, a string array is returned, and “ separates the strings from each ...


206

Python 3, 61 bytes rant="partisn't" print(("HHeelllloo,, WWoorrlldd!!"""[::2])) Try it online! Abusing the fact that print is a function in Python 3 :) The least partisan solution you'll find here on PPCG. Becomes rn=print rn("Hello, World!"[:])


169

Python 2, 33 bytes print len(open(__file__).read())# Try it online! Try it doubled Python 3, 28 bytes print(len(*open(__file__)))# Try it online! Try it doubled Explanation This opens up the source code using open(__file__) and gets its length using len the # prevents any additional code from being read. When the source is doubled so is the length.


106

Perl, 7×7 (42 non-spaces) for$i( 1..56 ) {$_= $i %8? $i% 7? $":7 : $/;1; print} Output: 7 7 7 7 7 7 7


103

Jelly, 1 byte ‘ Try it online! or Try it double! I have no idea how this works, but apparently it does.


90

><>, 41 bytes \< 1:: : &&* + i*n n c& %: 4l 0( .i n} &? Try it online: N+N, N*N, N^N. Assumes that the STDIN input is exactly one char. ><> is a 2D language, so we can make use of the fact that code semantics are mostly unchanged if we execute instructions downwards — the extra empty lines that ensue are just no-ops. The ...


77

CJam, 4X4 (12 10 non-spaces) 6, SS + * 4/ N* Output: 0 1 2 3 4 5 Previous version with 12 non-spaces: 4a4 * 4S ** 4 /N* And the output is 4 4 4 4 As pointed out by Martin, this version has 4 Spaces, 4 *, 4 4, 4 other characters, and 4 4 as the output ;) Try it online here


77

Google Sheets, 5 Bytes Anonymous worksheet formula that takes no input and outputs into the cell which holds the formula =4/(2 As a single formula this evaluates to a call stack that looks a little something like =4/(2 =4/(2) =4/2 =2 2 However when this worksheet formula is doubled this call stack evaluates down to =4/(2=4/(2 =4/(2=4/(2) =4/(2=4/(2)) =4/(...


75

Haskell, 11 bytes f=log pxe=f and in reverse order: f=exp gol=f This works without the "comment" trick. Instead each version defines an additional, but unused function (pxe/ gol).


72

zsh, 603 594 566 561 548 440 415 399 378 370 bytes ec ho \\n;ca t<<<$'\x20';exi t d$c -e8BC6P d0c -eKp $'\172\163\150' $'\055\143' $'\146\157\162 v \151\156 \173\043\056\056\134\175\175\073\173 \146\147\162\145\160 \055\161 $\166 '$0$'\174\174\074\074\074$\166\073\175' $'\145v\141\154' $':\073\072\046\046\145\170\151\164';#%&()*+,/9=>?@...


62

Befunge-98, 602 bytes "^@<"v@@ "'I'"00v>00g:: "@v"0v@@@>g::a">#" "a">v@@> 0g::'"1> / ...


62

Cardinal, 29 bytes % " H e l l o , W o r l d ! Try it online! Removing every other character removes all the linefeeds, which still results in Hello, World!: %"Hello, World! Try it online! The reason this works is that % creates four instruction pointers, moving in each of the four cardinal directions. IPs that leave the source code are simply ...


58

Python, distance 3 #Given a set of integers, find the sum#of all integers in it. This gives the built-in function sum, which can sum a set like sum({3,5,7})==17. The remaining parts are commented. This has distance 3, with 3 edits: Add the initial # Add a newline Replace the space after sum with #


57

Python 2, 48 47 bytes -1 byte thanks to Erik the Outgolfer print' 'and'Programming Puzzles'or'Code\40Golf' Try it online! print''and'ProgrammingPuzzles'or'Code\40Golf' Try it online!


54

Julia, distance 27 26 No comments! Given(a)=(Set;of;integer; find; [sum(a),all,integer,in][1]) This creates a function called Given that accepts an array and returns the sum of its elements. Since a lot of Julia builtins have relevant names (but are irrelevant to the calculation here), we can just list a few delimited with semicolons. As long as they aren'...


53

Python, 54 + 56 = 110 bytes Counter: m=lambda x:sum(y.isspace()for y in x) +1 0<9or x.split() Splitter: m=lambda x:sum(y.isspace()for y in x)+10<9or x.split() For the counter, we use the fact that Python is okay with having just an expression on a line. It's necessary to split up +1 and 0<9or x.split() to stop a NameError from being thrown, as 0&...


51

Marbelous - 16x16 ....@0..@1.... @3..0A08..@2 .. /\--....>1 ..Hp ..@2..\\ =0@3.. ss..// --\\\\.. @0/\ @1/\Hp..!! :s #the-cake-is 2020#a-pie/lie Test it here! Spaces as blanks, cylindrical board, and include libraries all must be checked. Output 07 06 05 04 03 02 ...


51

C (gcc), 37 bytes i;main(){putchar(i+49);}/* i=1;//*/// The file does not contain a trailing newline. Doubled version, for syntax highlighting: i;main(){putchar(i+49);}/* i=1;//*///i;main(){putchar(i+49);}/* i=1;//*/// TIO links: single, double.


51

Python 2, 21 bytes +1 if id:id=0;print 1 Try it online! Doubled: +1 if id:id=0;print 1+1 if id:id=0;print 1 Try it online!


50

C, 125 bytes xpxuxtxs( ) { }xuxs ( ) { } main( ) {puts ( "Hello, World!" ) ; } mxaxixn ( ) {xpxuxtxs ( " H e l l o , W o r l d ! " ) ; } Try it online! With even characters removed: xxxx(){}us(){}mi(){us("el,Wrd");}main(){puts("Hello, World!");} Try it online!


49

05AB1E, 2 bytes (1 Try it online! !enilno ti yrT ( # negate nothing 1 # push 1 (and implictly output it) 1 # push 1 ( # negate it (and implictly output it)


48

05AB1E, 2 bytes Original XO Try it online! Doubled XOXO Try it online! Explanation X pushes 1 to the stack. O sums the stack.


47

Javascript - action - 15x15 "Definetly not the shortest one, but PEW PEW PEW." - James Bond ction="action " ction+="means " actionac="PEW " ctionact="PEW " tionacti="PEW " ionactio="PEW " onaction="PEW " nactiona="PEW " ction+=actionac ction+=ctionact ction+=tionacti ction+=ionactio ction+=onaction ction+=nactiona alert(""+ction) Link to the ...


47

05AB1E, 1 byte r Try it online lowercase or uppercase! Finally a question which I (a dumb brain) can answer! Thanks for this easy, yet fun challenge! (I do feel great, even though it requires little effort to make an answer in 05AB1E.) Wait, how? r # reverses the stack. (Which literally does not do anything since only the # implicit input is in the stack) ...


46

Hexagony, 7 bytes /)!@.). Prints 1 regularly then 2 doubled. Try it online! or Try it doubled online! Expanded versions: Regular: / ) ! @ . ) . Doubled: / ) ! @ . ) . / ) ! @ . ) . . . . . . The regular program follows the path: /)!.@ which increments a memory edge (all are initialised to zero) then prints its numeric value. The doubled program ...


45

APL (1x3 = 3) 5!3 This solution uses the extra rule that any output that is correct mod 4 works. In APL, x!y is the number of way to choose x elements from y, commonly known as binom(y,x) or choose(y,x). Let's check that each rotation gives the right answer. 0 rotations 5!3 There's no way to choose 5 elements from 3, so we get 0, which is automatically ...


43

Ruby, 7×9 (63) 30;p 0||p=p 0|0;p;p ;p;p|p; p=p ||0 ;p p; 2||p =p 00;1 p A bit longer than the other solution, but at least this solution doesn't depend on any implicit printing or rule abuse. For all four rotations, the full code is parsed and other than some short-circuiting, all of it is executed. Surprisingly, there's absolutely no ...


42

Python 2, 59 bytes print " Hello, world!"[ 2::] #rint "T w i s t e r !"[ ::2] Twisted: print "T weils,twerrd!"[ ::2] #rint " H l o o l !"[ 2::] Basically, puts the Twister! data in the odd indices of the string and then changes from removing the first two (padding) characters to removing every other character ...


42

APL, 3 bytes *⊣⍟ This is a function train. Monadic * returns e^x, monadic ⍟ returns ln(x). ⊣ is a dyadic function that returns its left argument. Thus, *⊣⍟ is equivalent to just *, and the reverse ⍟⊣* is equivalent to just ⍟.


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