The Stack Overflow podcast is back! Listen to an interview with our new CEO.
590

PCRE flavor, 261 289 210 184 127 109 71 53 51 44 40 bytes Yes, it is possible! <^<()(?R){2}>\z|\1\Q^<()(?R){2}>\z|\1\Q> Try it here. (But / is shown to be the delimiter on Regex101.) Please refrain from making unnecessary edits (updates) on the Regex101 page. If your edit doesn't actually involve improving, trying or testing this regex, ...


226

hello, world!, 13 hello, world!


157

Hexagony, 29 bytes .?'.).@@/'/.!.>+=(<.!)}($>(<% The readable version of this code is: . ? ' . ) . @ @ / ' / . ! . > + = ( < . ! ) } ( $ > ( < % . . . . . . . . Explanation: It test if there is a number from 2 to n-1 who divides n. Initialization: Write n in one memory cell and n-1 in an other: . ? ' . . . . . ....


145

Python 3, 32 bytes eval(input().translate(")("*50)) Outputs via exit code: Error for false, no error for True. The string is evaluated as Python code, replacing parens ( for a and ) for b. Only expressions of the form a^n b^n become well-formed expressions of parentheses like ((())), evaluating to the tuple (). Any mismatched parens give an error, as ...


112

ArnoldC, 299 283 bytes IT'S SHOWTIME HEY CHRISTMAS TREE i YOU SET US UP 0 GET YOUR ASS TO MARS i DO IT NOW I WANT TO ASK YOU A BUNCH OF QUESTIONS AND I WANT TO HAVE THEM ANSWERED IMMEDIATELY GET TO THE CHOPPER i HERE IS MY INVITATION i I LET HIM GO 2 ENOUGH TALK TALK TO THE HAND i YOU HAVE BEEN TERMINATED This outputs 1 (which is truthy) for odd input and ...


110

Dominoes, 122,000 bytes or 72 tiles The byte count is the size of the saved file which is 0.122 MB. Domino computing was the inspiration. I have tested all of these up to symmetry (and beyond!) via a virtual-reality Steam game called Tabletop Simulator. Details I/O Start - This is included for clarity (not counted towards total) and is what 'calls' or '...


108

MATLAB, 4 bytes ispc From the documentation: tf = ispc returns logical 1 (true) if the version of MATLAB® software is for the Microsoft® Windows® platform. Otherwise, it returns logical 0 (false). There are also the functions ismac and isunix. I'll leave it to the reader to figure out what those functions do. Mego kindly asked for diagrams explaining ...


100

Java/JavaScript Polyglot, 108 107 106 bytes //\u000As->s.matches("(?i)(?!.*javascript)java.*"/* a=>/(?!.*javascript)^java/i.test(a/**/)?"car":"carpet" Run as Java //\u000As->s.matches("(?i)(?!.*javascript)java.*"/* a=>/(?!.*javascript)^java/i.test(a/**/)?"car":"carpet" Try it online! Note: don't trust the highlight as it's incorrect. The ...


95

J, 4 bytes -:&= Usage 'THERMODYNAMICS' (-:&=) 'RAMBUNCTIOUSLY' NB. parens are optional 1 Explanation = with 1 argument creates an equality-table comparing the elements of the input and its nub. ='ESTATE' gives the binary matrix = | E S T A T E --+------------ E | 1 0 0 0 0 1 S | 0 1 0 0 0 0 T | 0 0 1 0 1 0 A | 0 0 0 1 0 0 -: with 2 ...


94

Python 3, 457 316 306 bytes E=enumerate V={'+'} Q=[[(-j,i,k)for i,u in E(open(0))for j,v in E(u)for k in[{v}&V,'join'][u[j:j+2]=='|-']]] while Q: a,b,c,d,*e=A=tuple(x//2for y,x in sorted((y,x)for x,y in E(Q.pop())));e or exit('NOT') if{A}-V:V|={A};Q+=[[c,d,a,b]+e,A,A[2:]+A[:2]][a<c<b<d:][c<a<d<b:] if b==d:Q=[[a,c]+e] exit('KNOT') ...


82

JavaScript (ES6),  26 23 17 15  14 bytes Takes input as two ASCII codes in currying syntax (a)(b). Returns 4 for friends or 0 for foes. a=>b=>a*b/.6&4 Try it online! How? NB: only the integer quotient of the division by 0.6 is shown below. Combo | a | b | a*b | / 0.6 | AND 4 ------+----+----+------+-------+------ WU | 87 | 85 |...


75

Vim, 2 bytes <C-a>1 On Windows, <C-a> (ctrl+a) is mapped by default to Select All. If you type a 1 in select mode in Windows, it replaces the selection with what you typed (1) leaving a 1 in the buffer. On other operating systems, <C-a> by default is mapped to Increment number. Because there's no number to increment, it's a no-op, and ...


69

JavaScript (ES6), 64 bytes Takes input as an array of numbers. Falsy values are 0 or NaN. Truthy values are strictly positive integers. a=>a[p=1]*a.every(n=>a[p=a[n&p&p*n%5<0|~(p-=n)==9&&p/2]&&-n]^=p) Test cases let f = a=>a[p=1]*a.every(n=>a[p=a[n&p&p*n%5<0|~(p-=n)==9&&p/2]&&-n]^=p)...


68

Hexagony, 218 92 58 55 bytes Notice: This answer has been solidly beaten with a side-length 4 solution by Etoplay. )}?}.=(..]=}='.}.}~./%*..&.=&{.<......=|>(<..}!=...&@\[ The first ever non-trivial (i.e. non-linear) Hexagony program! It is based on the same squared-factorial approach as Sp3000's Labyrinth answer. After starting out ...


66

Pyth, 4 bytes }QPQ Prints True or False.


56

Python 3, 24 bytes lambda s:s[::2]==s[1::2] Try it online!


55

Retina, 16 bytes ^(?!(..+)\1+$).. Try it online! Let's start with a classic: detecting primes with a regex. Input should be given in unary, using any repeated printable character. The test suite includes a conversion from decimal to unary for convenience. A Retina program consisting of a single line treats that line as a regex and prints the number of ...


55

Pyth, 3 bytes _I_ Returns True or False. Try it online! How it works _ Reverse the input. _I Invariant-reverse; test if the reversed input is equal to its reverse.


55

Malbolge, 128 bytes, cracked by KBRON111 (=&r:#o=~l4jz7g5vttbrpp^nllZjhhVfddRb`O;:('JYX#VV~jS{Ql>jMKK9IGcFaD_X]\[ZYXWVsN6L4J\[kYEhVBeScba%_M]]~IYG3Eyx5432+rpp-n+l)j'h%B0 Have fun! (Yes, I learned Malbolge just for this. Yes, it took an absurdly long time to finally get working. And yes, it was totally worth it.) Wrapped, so you can see it in its ...


54

Python 2.7.10, 24 bytes import os 0/('['>os.sep) Thanks to FlipTack for 3 bytes This program takes advantage of the fact that Windows is the only OS to use \ as a path separator. Normally this is frustrating and bad, but for once it is actually an advantage. On Windows, '['>os.sep is false, and thus 0/0 is computed, causing a ZeroDivisionError and ...


54

Snails, 13 bytes !(t\P(o\ ),o~ Try it online! Prints 0 for insecure prisons and the size of the input's bounding box for secure prisons. The idea is to ensure that we can't find a path from a P to an out of bounds cell (~) moving only orthogonally (o) through spaces. The t is a teleport so that regardless where we attempt the match it tries all possible ...


52

CJam, 4 bytes qimp CJam has a built-in operator for primality testing.


49

x86 machine code, 12 bytes 8c c8 83 f8 23 b0 20 75 02 00 c0 c3 Ungolfed: getKernelBitness: mov eax,cs cmp eax,0x23 ; 32 bit process on 64 bit kernel has this selector in CS mov al,32 jne kernelIs32Bit add al,al ; return value in eax kernelIs32Bit: ret This function works in Linux when used in ELF32, following i386 SysV ABI, as ...


49

Malbolge, Doorknob Try it online (Thanks Dennis!) Input for Windows: F_⌠1234567890 Input on Linux based system using ISO-8559-1: F_ô1234567890 The heart of how the Malbolge program worked is that it depended on a behavior of the Malbolge interpreter which causes an infinite loop if it encounters any instruction which is not between 33 and 126. The ...


48

HTML+CSS, 254+nmax*28 bytes We can check primality using regular expressions. Mozilla has @document, which is defined as: @document [ <url> | url-prefix(<string>) | domain(<string>) | regexp(<string>) ]# { <group-rule-body> } To filter elements via CSS based on the current URL. This is a single pass, so we have to do two ...


47

Python, 39 bytes lambda s:s[::-1]==s#s==]1-::[s:s adbmal Try it online! Boring, but if there is shorter in Python it will be impressive.


46

Python, 22 bytes lambda N:N-1&1-N>N**.5 This is a port of my Jelly answer. Test it on Ideone. How it works Let j be a strictly positive integer. j + 1 toggles all trailing set bits of j and the adjacent unset bit. For example, 100112 + 1 = 101002. Since ~j = -(j + 1) = -j - 1, -j = ~j + 1, so -n applies the above to the bitwise NOT of j (which ...


46

Python, 24 bytes range(123,790,111).count An anonymous function that outputs 0 or 1. It creates the list [123, 234, 345, 456, 567, 678, 789] and counts how many times the input appears. f=range(123,790,111).count f(123) => 1 f(258) => 0


46

brainfuck, 8 bytes +[,>,]<. Input is in unary. Output is the 1 (truthy) for odd numbers and NUL (falsy) for even numbers. Try it online! How it works We start by incrementing the current cell with + to be able to enter the while loop [,>,]. In each iteration, , reads a byte from STDIN, > advances to the cell to the right, then , reads ...


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