59

Brain-Flak Classic, 1271 1247 1239 bytes <>(()){<>((([][][][][])<(((({}){})(({})({}))[])({}(({})({}({})({}{}(<>)))))[])>{()<{}>}{})<{{}}{}>())}{}<>(<(({()(((<>))<>)}{}{<({}(([][][])((({})({}))[]{})){})>((){[]<({}{})((){[]<({}{}<>((({})({})){}{}){})(<>)>}{}){{}{}<>(<(...


33

Mini-Flak, 6851113 cycles The program (literally) I know most people aren't likely expecting a Mini-Flak quine to be using unprintable characters and even multi-byte characters (making the encoding relevant). However, this quine does, and the unprintables, combined with the size of the quine (93919 characters encoded as 102646 bytes of UTF-8), make it ...


32

Brain-Flak, 952 916 818 bytes {(({})[(((()()()()()){}){}){}])((){[()](<{}>)}{}){{}(({})()<>)(<>)}{}(<>)<>(({})[(((()()()){}){}()){({}[()])}{}])((){[()](<{}>)}{})({}<>{})<>(({})[((((()()()()()){}){})){}{}])((){[()](<{}>)}{})({}<>{})<>(({})[(((((()()()()()){}){}){}())){}{}])((){[()](<{}>)}...


27

Brain-Flak, 685, 155, 151, 137 bytes (())({<{}({}()<(()()()())>)({}(<>))<>{(({})){({}[()])<>}{}}{}<> ([{}()]{})(({})){{}({}[()])(<()>)}{}(<>)<>{{}<>{}({}<>)}{}(<>[]<>)>()}<>) Try it online! 136 bytes of code, plus one byte for -a. One indexed. 530 bytes golfed off! That's ...


22

Use the Third Stack If you have read the title you might be a bit confused. Surely there are only two stacks in Brain-Flak? However I assure you that it exists and it is one of the most powerful if not the most powerful tool in writing and golfing Brain-Flak. What is the "Third Stack"? Every Brain-Flak program uses the third stack in one way or another ...


22

Python 2, 39 37 36 34 bytes -1 thanks to dzaima -2 thanks to Erik the Outgolfer exec("".join([chr(len(x))for(x)in'()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(){}()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(){}()()()()()()()...


21

Finding modulus/remainder Finding n modulo m is one of the basic arithmetic operations, important for many challenges. For cases m > 0 and n >= 0, the following 46-byte snippet may be used. It assumes that n is on top of the active stack with m the next one down, and replaces them with n mod m. It leaves the rest of the stacks intact. ({}(<>))<>...


21

Brain-Flak, 276 bytes {({}<>)<>}<>{(((()()()()()){})((({}){})())(({})({}{}([{}])(<>))))((()()(){[()]<{}>}{}){()<{{}}>}{}<<>({}({})())>{()(<{}>)}{}<>)<>}<>{(([{}]()<>)){{}({}())((){[()](<({}())((){[()](<({}())((){[()](<{}([{}]{})>)}{}){(<{}{}>)}{}>)}{}){(<{}(...


20

Haskell (before GHC 8.4), (10119 7767 7626 7540 bytes), score 15 14 10 (<>)(<><>)(<>)(<<>>)()=(((<>)((<>)((<>)((<>)((<>)((<>)((<>)((<>)((<>)((<>)((<>)((<>)((<>)((<>)((<>)((<>)((<>)((<>)((<>)((<>)((<&...


16

128,673,515 cycles Try it online Explanation The reason that Miniflak quines are destined to be slow is Miniflak's lack of random access. To get around this I create a block of code that takes in a number and returns a datum. Each datum represents a single character like before and the main code simply queries this block for each one at a time. This ...


16

Python 2, 59394 59244 58534 58416 58394 58250 Ok here is my solution. import re import math cache = {0:"<()>"} def find(x,i,j): return i*((x**2+x)/2)+(j+1)*((x**2-x)/2) def solve(x, i, j): a = (i + j + 1)/2. b = (i - j - 1)/2. c = -x return (-b + math.sqrt(b**2 - 4*a*c))/(2*a) def size(i,j=0): return 4*(i+j)+14 def ...


13

Brain-Flak, 64664 Try it Online! Here is my annotated code ({}< ((((()()()()()){}){}){}()) #41 >) { (({})[()()()()()()]) ([({}<(())>)](<>)){({}())<>}{}<>{}{}<>(({})){(<{}({}<>)>)}{}({}<>) {((< #IF {} {({}[()]< #FOR ((((()()()()()){}){}){}()) #41 (({})[()]) #40 >...


13

Retina, 254 252 264 248 240 232 267 bytes Thank you to @AnthonyPham, @officialaimm, and @MistahFiggins for pointing out bugs T`[]()`:;'" +`'-*"|:-*;|{-*}|<-*> - +`'(\W+)"|:(\W+);|{(\W+)}|<(\W+)> A$1$2$3$+B +`'(\D+)"|:(\D+);|{(\D+)}|<(\D+)> 6$1$2$3$+9 (.*)(}{|"'|;:|><) 1$1 - A6B9|6A9B 1 A6+B9+|A6+.B9+.|A+6.B+9 11 T`':{";}`<<&...


13

Brain-Flak, 130 bytes {({}<>)<>}<>{((((()()()()()){}){}){}<>)<>{(((((()()()()()){}){}){}<>)())<>({}[()])}<>((((()()()()()){}){}){}())<>{}}<>{({}<>)<>}<> Try it online! Output for <your brain-flak code here>: 5045 bytes (()()()()()()()()()()()()()()()()()()()()()()()()()()(...


12

Brain-Flak, 1350 bytes {({}(())(<>))<>({(()()()())<{({}[()])<>}{}>}{}<>({<({}[()])>{()(<{}>)}}{}{}<>))<>}<>([[]]){([[]({}()<>)]<>)<>{(({}())<<>(({})<(({}(<()>))<>({}))([(())()()]){<>({}())}{}{<>{}<>({}()){(((({}<(({}<>)<{({}()&...


12

Jelly, 7 6 bytes “”Lb⁹Ọ Inside the “” you need to put the output of this Jelly program: ⁾()Ȯ“cWṪḂÇa'ỴOḞḊʂFGĖƓẋ0Ɗ/⁷ẓƊĖṘḲ"ÇẈW'ⱮḟėıḲ7¿’¡ -1 byte thanks to Jonathan Allan (allowed trailing newline) There are 53127666317289661939246122975355844970973062889031671423309402549417051416384149‌​80886139013 (we'll call this n) ()s between “”. Explanation:“”Lb⁹Ọ ḷ“...


12

Retina, 59 - 24 = 35 bytes Su{p()se!¶Ha<<>[]i{thd}>,[](a)n-Fl}k! T`<>()[]{}`\pyri Bra Try it online! By comparison, the boring solution takes 38 bytes.


11

Push-Pop Redundancy This is a big one. It is also a little bit of a nuanced one. The idea is that if you push something and then pop it without doing anything you should not have pushed it at all. For example, if you want to move something to the offstack and then add one to it you might write the following code: ({}<>)({}()) This can be simpler ...


11

Vim, 23 bytes :se mps+=<:> %DVr<C-a>C1<esc>@" Try it online! I'm really sad about this answer. This solution is beautifully elegant and short, but, by default, vim does not consider < and > to be matched, so I need 13 bytes of boilerplate code. Otherwise, this would just be 10 bytes. I would have posted a V answer, but that would ...


11

05AB1E, 17 16 10 bytes -1 thanks to carusocomputing -6 thanks to Adnan for his amazing insight that "after incrementing, the second last bit is 0 for an opening bracket and 1 for an closing bracket" Ç>2&<.pO0k Try it online! Ç # Get input as ASCII values > # Increment 2& # And with 2 (0 for open and 2 for ...


11

Lenguage, 0 bytes Just ...


10

Perl, 59222 59156 58460 characters n() (11322660 characters) (n){}() (64664 characters) ((n)){}{} (63610 characters) ((n)()){}{} (63484 characters) - this is a novel calculation (n){({}[()])}{} (60748 characters) n[m] (62800 characters) (n){m({}[l])}{} (58460 characters) - this is a novel calculation The formula for that last calculation is n(n/l+1)/2+mn/l....


9

Retina, 26 24 bytes M!`^.(?<-1>([[({<])*.)* Try it online! Result is 1-based. Explanation A very different Retina solution that is essentially based on a single (and very readable...) regex. This uses a new technique I discovered yesterday for matching balanced strings using balancing groups. M!`^.(?<-1>([[({<])*.)* Find (M) and ...


9

Haskell, (12006 13485 bytes), score 18 17 EDIT: -1 byte: Got the toEnum version to work without extensions by moving the toEnum to the main function, at the cost of a $. -1 byte, then +1 again: If you look in the edit history, you'll see I changed to something completely different. And only later did I check the other answers and see that @Laikoni had done ...


9

Charcoal, 3 bytes S‖T Try it online! Link is to verbose version of code. Explanation: S reads the input and implicitly echos it, while ‖ is the mirroring operator, which normally just reverses the input, but the T modifies it to mirror the characters at the same time.


8

APL, 255 257 bytes b←{S←(⌽⍺)⍬ e←{0=⍴⍵:0 v+∇⊃_ v←∇{r←⊂2↓⍵ '()'≡n←2↑⍵:r,1 '[]'≡n:r,¯1 '{}'≡n:r,{i←⊃⊃⊃S⋄S[1]↓⍨←1⋄i}⍬ '<>'≡n:r,0⊣S⌽⍨←1 r←⊂⍵↓⍨i←0⍳⍨(+\c=⍵)-+\')]>}'['([<{'⍳c←⊃⍵]=⍵ i←1↓¯1↓c←i↑⍵ '('=c←⊃c:r,S[1],⍨←⍺⍺i '['=c:r,+⎕←⍺⍺i '{'=c:r,{0≠⊃⊃⊃S:∇e i⋄0}⍬ '<'=c:r,0⊣⍺⍺i}⍵} ⎕←⍪⊃S⊣e⍵} This takes the program as its right argument, and the program input ...


8

Haskell, (1965 3131 18073 bytes), score 31 23 19 (<>)=(:) (<<>>)=['\n'..] (((<<><>>):(<<<>>>))<<>><>([()]:(<><>)))()=(<<><>>)<>(((<<>>)<<>><>(<><>))()) (((<<><>>):(<<<>>>))&...


8

Japt, 19 14 13 10 9 8 bytes "(()()...()()<"q>)m(l)m(d)q where the string at the beginning is: (()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(<>()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<>()()()()()()()()()()()()()()()()()()()()()()...


7

APL (Dyalog Classic), 146 bytes ↑⍕¨s⊣{⍎⍕1 ¯1'(s↓⍨←1)⊢⊃s' '0⊣s t←t s' 's,⍨←+/∇¨a' '⎕←+/∇¨a' '∇{×⊃s:∇⍺⍺¨a⋄0}0' '0⊣+/∇¨a'[(⊃⍵)+4×⍬≢a←1↓⍵]}¨⍎∊(')',⍨'(',¨⍕¨⍳4)[0,4,⍨'([{<'⍳⍞]⊣s←⌽⎕⊣t←⍬ Try it online! one Classic interpreting another :)


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