123

R, 9 bytes F:volcano Try it online! The sequence operator : coerces its arguments to integers. F is the boolean FALSE, which gets coerced to 0. volcano is one of the many built-in datasets (it gives topographic information about Maunga Whau in New Zealand); since it is a matrix, : fetches the value at position [1, 1] which is luckily equal to 100. The code ...


87

Buffalo, 2711 2571 2517 bytes It takes 352 [Bb]uffalo to output 8 [Bb]uffalo?! Yep, you herd that right. BuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffalo(buffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffalo(...


57

Microsoft Excel, 9 bytes =A1+"0:1" Input is in cell A1. Tested on my Mac (Excel for Mac version 16.53) and online at Office.com.


55

Bash, 28 bytes echo {B,b,B,b,b,b,B,b}uffalo Try it online! Brace expansion (Bash Reference Manual) Same length, slightly more interesting: echo {B,b,B,b{,,},B,b}uffalo


53

Minecraft, 358 293 277 276 bytes Implementing Minceraft in Minecraft Should be run as a set of commands in game. Should be run on a fresh superflat (redstone ready) world. Byte count is the amount of characters you need to type, including newlines. /scoreboard objectives add s dummy /summon bat /execute as @e[type=bat] store result score o s run data get ...


52

Emotion, 17 bytes πŸ˜πŸ˜ƒπŸ’πŸ§ŸπŸ€―πŸ˜ƒπŸ˜§πŸ˜πŸ˜„πŸ€ΆπŸ™†πŸ™†πŸ˜¬πŸƒπŸ§›πŸ˜§πŸ€  Explanation πŸ˜πŸ˜ƒπŸ’πŸ§Ÿ Push literal 280 🀯 Enter an iteration block over the first stack value and push the iteration element register at the begining of each loop. πŸ˜ƒ Push literal 1 😧 Push the sum of the second and first stack values. πŸ˜πŸ˜„πŸ€ΆπŸ™†πŸ™† Push literal 1114112 😬 Swap the top two stack values. πŸƒπŸ§› ...


43

Wolfram Language (Mathematica), 23 bytes Β―\__(ツ)_/Β― of course there is a built in for this... "BD"~CountryData~"Flag" but you can also get the same result with... Wolfram Language (Mathematica), 78 bytes Graphics@{(c=RGBColor)@"#006a4e",{0,0}~Cuboid~{5,3},c@"#f42a41",Disk[{9,6}/4]} -8 bytes {first code) thanks to @...


36

05AB1E, 15 12 10 9 bytes -1 byte thanks to Kevin Cruijssen! This could be 8 bytes without the l, but why would I remove that? vyxaliŠìì Try it online! v # for each character y: y # push y x # duplicate TOS and double the copy # double is a noop on alphabetic strings a # is the doubled copy ...


34

Rust, 38250 14716 bytes use std::{io::{stdin,Read},ops::{Add,Index,IndexMut,Sub},collections::HashSet,fmt::{self,Write}};use lazy_static::lazy_static;use regex::Regex;use tap::Tap;use hashbag::HashBag;trait Ta:l+Sized{fn V(&mut self,d(A,o,D):d){let mut ha=A;if A[o]>1{ha[o]-=1;}else{ha[o]+=1;}let Da=if o==c::X{c::Y}else{c::X};self.u(d(ha,o,D));self.u(d(...


33

SVG, 67 bytes By tweaking the viewBox, we can take advantage of the fact that the stroke of a shape has a default width. That avoids creating any element for the background. <svg viewBox=-.9,-.6,2,1.2><circle r=.9 fill=#f42a41 stroke=#006a4e


32

Python 2, 16 bytes lambda n:n<<n%-2 Try it online! The expression n%-2 equals 0 for even n and -1 for odd n. Bit-shifting n by 0 positions leaves it unchanged, but for -1 positions it gives an error for "negative shift count".


31

Python 3: 27 23 20 Bytes Thanks to caird coinheringaahing for -4 bytes, ovs for -3 bytes print(*range(*b'e')) I'm pretty poor at golfing, so there's probably a better way to do this. TIO


31

Vim, 809 580 bytes -229 bytes because shenanigans and balderdash. qq<C-v><C-v><C-v>q<Esc>^mbO<C-r>q elsei "<C-r>q<C-r>c"=="<Esc>^"xc$<C-r>q norm <Esc>^"zc$en<C-r>q <Esc>^"yd$i`b"cyl:if "<C-v><C-r>c"==">"<C-r>z@f&...


28

Python 2, 36 bytes for c in'BbBbbbBb':print c+'uffalo', Try it online! Relies on the Python 2 print magic that automagically adds a space before a printed object if it thinks it's not at the beginning of a line. Python 2 (anagol), 36 bytes print'uffalo '.join('BbBbbb'*2)[:63] Try it online! A trivial modification of the anagol solution is the same length....


28

Haskell, 35 bytes x?y|isNaN$x/y=tanh x*tanh y|0<1=x/y Try it online! The relevant function is (?), which takes two Doubles as input and returns a Double as output. How? The hyperbolic tangent is an amazing function (two bytes shorter than signum!). x tanh x 0.0 0.0 -0.0 -0.0 Infinity 1.0 -Infinity -1.0 Haskell, 30 29 bytes x?y|x/y<=1/0=x/y|0<...


28

Python 2, 49 bytes Takes as input a 2D binary matrix \$ a \$, and its size \$ n \$. lambda a,n:sorted(map(sum,a+zip(*a)))[-2:]==[1,n] Try it online! There may be shorter approaches, but this is what I could find for now. Please let me know if the algorithm is incorrect. Explanation Since there is exactly one line, there should be exactly one row/column ...


28

Vyxal, 3 bytes β‚ˆΟ„C Try it Online! Ο„ # Convert to base... β‚ˆ # 256 C # Get charcodes


27

SVG in HTML, 74 bytes <svg viewBox=-9,-6,20,12 style=background:#006a4e><circle r=4 fill=#f42a41 -8 bytes by Joey


26

Jelly, 3 bytes MαΈ‚Β‘ Try it online! (even) and Try it online! (odd) How it works M is an atom meaning "Given a list, yield the indices of that maximal elements". Now, typically, when given integer arguments to its array functions, Jelly promotes them to either a range, to digits, or just wraps it. Unfortunately, (I'm guessing due to M's age - it was ...


26

Python 2, 25 22 bytes lambda s:hash(s)%591^1 Try it online! Takes input in upper case and returns the following numbers: ODD -> 263 EVEN -> 554 SQUARE -> 121 CUBE -> 512 PRIME -> 349 COMPOSITE -> 371 Generated with this script which searches for formulas following hash(s)%x?y, where ? is any binary operator: ...


26

Python 2, 42 bytes f=lambda n,x=1:1/n*[x]or[x+1]+f(n-1,x*-~x) Try it online! The key thing to observe is that 1/n = 1/(n+1) + 1/(n*(n+1)). Therefore we can always obtain a solution with n fractions, by using a solution with n-1 fractions, and "splitting" the last fraction in two.


25

Python3 + Turtle, 112 84 bytes from turtle import* setup(286,176) bgcolor("#006a4e") ht() bk(14) dot(114,"#f42a41") -28B thanks to Digital Trauma Can't try it online but here is how it looks:


25

Alice, 138 128 74 70 bytes <pp&a0Ra*880R9Z640R8Z5e0R7*a70R6Z060R5Z9e0R4Z4R20R3*79Y3Zea0eZ1R51!Z73 Unfortunately, I had to fix a bug in the interpreter to make this work, so the current version doesn't work on TIO. But you can try the 128-byte solution online. You can use this Python script to verify that it works for all rotations, but again you'll ...


25

JavaScript (ES6), Β 43Β  42 bytes s=>([,x,y]=s.split`.`,x*x+x*3+~~y)/51^x>16 Try it online! How? Given an input string 1.x.y, we compute: $$\left\lfloor\frac{x^2+3x+y}{51}\right\rfloor$$ Because we're using ~~y, we implicitly assume \$y=0\$ if the input string is just 1.x. This gives the correct result for all versions except the last one, which gives \...


25

My solution to 50 bytes: v=1 for x in input().split()*6**6:v+=-v%int(x) print(v) Explanation The solution itself is relatively simple, but finding it was significantly more difficult. First, note that the LCM of a and b is the smallest number v such that v%a==0 and v%b==0. The main logic for this algorithm is in v+=-v%int(x). In a nutshell, it sets v to the ...


24

C, Bash, C++, score 174.5 175 C, 301 bytes - Quine #include<stdio.h> int main(){ #ifdef __cplusplus printf("Hello, World!" #else char*c="#include<stdio.h>%cint main(){%c#ifdef __cplusplus%cprintf(%cHello, World!%c%c#else%cchar*c=%c%s%c;printf(c,10,10,10,34,34,10,10,34,c,34,10,10%c#endif%c);}//";printf(c,10,10,10,34,34,10,10,34,...


24

Canvas, 1 byte Better tool for the job ;) \ Try it here! Given an integer, this draws a diagonal of that string. If you pass a string instead, this prints the string along the diagonal. There is matching anti-diagonal builtin / as well.


24

90 79 72 67 65 64 bytes ^(?!([258][0369]*[147]|[1475][258]|[147]{3}|[0369])+$)\d+[1379]$ Matches 2–3-digit numbers not divisible by 2, 3, or 5, with an added bit (the 5 in [1475]) that removes 8 false positives (527, 529, 551, 553, 559, 581, 583, 589) and adds 4 false negatives (521, 523, 557, 587). -2 thanks to Nahuel Fouilleul; -9 by removing [258]{3}, ...


24

Python 2, 27 bytes lambda L:(2*L*L-2)**.5//1+3 Try it online! A direct formula: $$ f(L) = \lfloor \sqrt{2 L^2-2}\rfloor + 3 $$ Derivation As noted by @Kirill L. and others, the optimal layout uses a near-diagonal line segment whose horizontal and vertical span are at least \$(h,h)\$ or \$(h,h+1)\$. We need the length-\$L\$ to cover at least this much ...


23

JavaScript (ES6), 43 bytes Browser only. _=>atob`MSwgMiwgbWlzcyBhIGZldywgOTksIDEwMA` Try it online! (with a polyfill) JavaScript (ES6), 45 bytes _=>[4-3,5-3,'miss a few',33*3,5*5*4].join`, ` Try it online!


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