g | x | w | all
Bytes Lang Time Link
009How dare you fuck the brain241003T184211ZGleb
049C gcc240409T153657ZMukundan
003Uiua240922T150419ZjanMakos
098Rust240412T123009Zuser9403
004Japt R240814T131130ZShaggy
015Trilangle240519T223233ZBbrk24
027AWK240519T212442ZC K
005Ly240505T044121Zcnamejj
026Scala 3240504T111720Z138 Aspe
065Acc!!240417T035406ZMukundan
038sed240414T102022Zguest430
028!@#$%^&*_+240418T161106ZAiden Ch
082Acc!!240418T051908ZDLosc
110In Floop240416T232716Zemanresu
252Thue240417T012727ZDLosc
008TacO240416T231633ZATaco
033tinylisp240416T203147ZDLosc
007Regenerate240416T194113ZDLosc
008Ouroboros240416T033821ZDLosc
006BQN240416T025344ZDLosc
06999240415T193033ZAiden Ch
006Minkolang240415T183750ZAiden Ch
028MarioLANG240415T183538ZAiden Ch
015PingPong240415T174720ZAiden Ch
018Python240414T183040Zuser9403
020Python 2240409T132525ZMukundan
002Vyxal240409T124319Zlyxal
003Uiua 0.10.0240409T131144ZTbw
009jq240413T044546ZGammaFun
019Zsh240413T044202ZGammaFun
010TIBASIC TI84+CE240411T182720ZSylveste
002Nekomata240412T100240Zalephalp
012PARI/GP240412T023256Zalephalp
012Ruby240412T054737ZG B
013PowerShell Core240411T213246ZJulian
010BitCycle u240411T074512ZAiden Ch
004Brachylog240411T144815ZFatalize
nanPiet + asciipiet240411T074853ZAiden Ch
054FreePascal240409T220002ZKai Burg
019Octave / MATLAB240410T144650ZLuis Men
689C++240409T145117ZSomeone
010*><>240410T153439ZBee H.
025JavaScript Node.js240410T002259Z2pichar
025Brainfuck240409T141233Zmatteo_c
00205AB1E240409T124407ZKevin Cr
055Whitespace240410T085109ZKevin Cr
016JavaScript ES11240409T205239ZArnauld
041F# .NET 6+240410T061011Zdtanku
037Haskell240409T141048Ztotallyh
022Bash240410T042621ZMukundan
032Quipu240409T201940ZDLosc
031SQL Oracle240409T200413ZDitto
007Knight v2240409T192300ZAiden Ch
018JavaScript Node.js240409T175628Zl4m2
004Charcoal240409T165505ZNeil
007Retina 0.8.2240409T165257ZNeil
013Google Sheets240409T155609Zz..
006Pip240409T155345ZKenzie
009Perl 5 p240409T150913ZXcali
003Jelly240409T135658ZJonathan
011Brainfuck+2240409T131959ZNone1
003MathGolf240409T125457ZKevin Cr
006APL+WIN240409T124523ZGraham

How dare you fuck the brain, 12 9 bytes

I=;|D^Nv)

Try it online

C (gcc), 49 bytes

-4 bytes thanks to @ceilingcat

main(c){for(scanf("%d",&c);~c;)putchar(49^!c--);}

Try it online!

Uiua, 3 bytes

¬°⊚

Explanation

 °⊚ # histogram (4 -> [0 0 0 0 1])
¬   # logical not ([0 0 0 0 1] -> [1 1 1 1 0])

```

Rust, 98 bytes

fn main(){print!("{}{}","1".repeat(std::env::args().nth(1).unwrap().parse::<usize>().unwrap()),0)}

Attempt This Online!

Japt -R, 4 bytes

ò@gX

Try it

ò@gX     :Implicit input of integer U
ò        :Range [0,U]
 @       :Pass each X through the following function
  gX     :  Sign of difference with U

Trilangle, 15 bytes

?<.>.(),/.!/'1!

Playground link

Issues warnings (in the online interpreter or with -w set) and exits with an error.

Unfolded:

    ?
   < .
  > . (
 ) , / .
! / ' 1 !

Roughly equivalent to this C code:

extern int get_int(); // Read stdin until an integer is found, then return that

int main() {
  int i = get_int();
  while (--i >= 0) {
    printf("%d\n", 1);
  }
  printf("%d\n", ++i);
  return 1;
}

Trilangle, no errors, 16 bytes

?<.>.(),/.!/'1!@

Playground link

Same idea as above, but add an exit opcode before it wraps around to the parts that error.

AWK, 27 bytes

{for(;$1+1;)print $1--?1:0}

Try it online!

Ly, 5 bytes

R[Lu]

Try it online!

I found 5 different Ly programs that met the challenge in 6 characters. Then I accidentally stumbled onto this one...

R      - generate a sequence from 0..N (from STDIN)
 [  ]  - loop while the top of stack is non-zero
  L    - "less than" compare top two entries (will be 1)
   u   - print the top of stack

Scala 3, 26 bytes

println("1"*readInt()+"0")

Attempt This Online!

Acc!!, 65 bytes

Count i while _%11-10 {
_*10+_%11+N%48
}
Write 49)*(_/11
Write 48

Try it online!

Abuses a bug in the official interpreter

Acc!!, 105 88 85 81 bytes

-5 byte thanks to @DLosc

Count i while _%11-10 {
_*10+_%11+N%48
}
Count i while _+1 {
Write 49-10/_
_-11
}

Try it online!

sed, 39 38 bytes

s/.*/echo {0..&}/e  #0 to n seperated by spaces
s/[^ ]//g           #only keep the spaces
y/ /1/              #spaces to 1s
a0                  #append a 0

Try it online!

!@#$%^&*()_+, 28 bytes

>_(>+$!+!!+!+++n_*)+(!#_+)#

Try it online!

Input is a non-negative integer followed by the character "n". This is allowed as per this default I/O method (in this case, the input is actually an array of characters with the sentinel value being the character "n").

The character after the second ( is an ASCII 1 character.

The first loop is a golfed version of the "Input a Decimal Number" algorithm in this Esolangs article, using "n" as a sentinel value instead of a newline.

Acc!!, 87 86 82 bytes

N
Count i while _%96 {
_/96*960+_%48*96+N
}
Count i while _ {
_-960
Write 49-0^_
}

Try it online!

Explanation

Depends on the slightly unofficial behavior of the official interpreter, in which the input always ends with a newline character.

# Accumulator format: value * 96 + next_char
# Read first character
N
# Loop until next_char is EOF (0)
Count i while _%96 {
  # _/96*96*10   Multiply previous value by 10
  # +_%48*96     Add new digit to it (or 10 if character was newline)
  # +N           Read next character
  _/96*960+_%48*96+N
}
# For an input number X, the accumulator is now equal to (X * 10 + 10) * 96
# which is the same as (X + 1) * 960
# Loop until accumulator reaches 0
Count i while _ {
  # Decrement accumulator in steps of 960
  _-960
  # Output '1' if accumulator is still positive, '0' if it is now 0
  Write 49-0^_
}

In Floop, 110 bytes

s+n+@?[s-]n-s[-n@;]s+r[s-]s[s-n@+r+]s+r-[s-]r+s[o++++++++++n@-[s-]s[-r+]]s+r--[s-]r++s[n@+o-[s-]s[-r--n+@-n-]]

Try It Online! This was a massive pain to write. Takes about ten seconds for n=3.

This would be a fairly easy challenge even for a Turing tarpit like In Floop... if there was a print instruction. In Floop only outputs the value of the current variable on termination. So, we have to calculate the output value as a single integer by repeatedly adding 1 and multiplying by 10.

In Floop has four integer variables; n, o, r, and s; in addition to an arbitrarily large array of integers @ which can be indexed into by the variables. Unfortunately, the state machine I came up with for this has five, which I'll call input (@[1]), state (r), inv (s), acc (@[0]) and copy (o).

One other thing I should note is that In Floop can only check if a variable is nonzero, so I'll use the idiom s+r+[s-]s[-...] to check if a variable's zero a lot - Set s to 1, if condition's nonzero set it to 0, if s is nonzero set it to 0 and continue.

s+n+@?[s-]n-s[-n@;] # Termination check / setup
  n+@?    n-        # Try writing input value into input
s+    [s-]  s[-   ] # If it's zero
               n@;  # Print acc and terminate


s+r[s-]s[s-n@+r+] # Set up multiplication
s+ [s-]s[s-     ] # If 
  r               # State is 0 (start)
           n@+    # Increment acc
              r+  # State = 1 (multiplying)

s+r-[s-]r+s[o++++++++++n@-[s-]s[-r+]] # Multiply acc by 10
s+  [s-]. s[                        ] # If
  r-    r+                            # State is 1 (multiplying)
            o++++++++++               # Add 10 to copy
                       n@-            # Decrement acc
                          [s-]s[-  ]  # If acc == 0
                                 r+   # State = 2 (copying)

s+r--[s-]r++s[n@+o-[s-]s[-r--n+@-n-]] # Finish loop
s+   [s-]   s[                      ] # If
  r--    r++                          # State == 2 (copying)
              n@+                     # Increment acc
                 o-                   # Decrement copy
                   [s-]s[-         ]  # If copy is zero
                          r--         # State = 0 (setup)
                             n+@-n-   # Decrement input

Thue, 252 bytes

N::=:::
9)::=)T9
8)::=)T8
7)::=)T7
6)::=)T6
5)::=)T5
4)::=)T4
3)::=)T3
2)::=)T2
1)::=)T1
0)::=)T
9|::=8|1
8|::=7|1
7|::=6|1
6|::=5|1
5|::=4|1
4|::=3|1
3|::=2|1
2|::=|11
1|::=|1
T|::=|T
1T::=T1111111111
()|::=P
PT::=P
P1::=P!1
!1::=~1
P0::=~0
::=
(N)|0

Try it online! (Note that the newline at the end of the input seems to be mandatory; otherwise, the interpreter doesn't read the last character of the input.)

Explanation

Thue is a non-deterministic string-rewriting language. The program comes in two parts: the top section, above the ::= line, is a list of rewriting rules, and the bottom section, below the ::= line, is the initial state. At every step, a rule that can be applied to the current state is picked at random and applied. Once no rules can be applied, the program halts.

Our initial state is:

(N)|0

to which the only rule that can be applied is the first one:

N::=:::

::: is a special replacement that reads a line of stdin. We now have our decimal input number within the parentheses.

9)::=)T9
...
1)::=)T1
0)::=)T

Move the rightmost digit outside of the parentheses and add a T marker indicating that everything to the left of it needs to be multiplied by 10.

9|::=8|1
...
2|::=|11
1|::=|1

Move the digit through the pipe character, converting to unary.

T|::=|T
1T::=T1111111111

Move T through the pipe character as well; anytime there's a 1 to its left, convert to ten 1s on its right.

()|::=P
PT::=P

Once the whole number has been converted, replace everything before it with P for printing mode.

P1::=P!1
!1::=~1

Any time P is followed by 1, insert ! before the 1; any time ! is followed by 1, remove both and output 1.

P0::=~0

Once all the 1s are gone, output 0.

TacO, 8 bytes

@#*i
0 1

I believe this is optimal, even with the wasted #.

Try it online!

tinylisp, 33 bytes

(d F(q((N)(i N(c 1(F(s N 1)))(q(0

Defines a function F that takes an integer and returns a list. Try it online!

(d F(q((N)(i N(c 1(F(s N 1)))(q(0))))))
(d F                                  ) ; Define F as
    (q(                             ))  ; a function
       (N)                              ; of one parameter, N:
          (i N                     )    ;  If N is truthy (nonzero):
              (c 1          )           ;   Prepend 1 to
                  (F       )            ;   the result of a recursive call
                    (s N 1)             ;   with argument N-1
                                        ;  Otherwise:
                             (q(0))     ;   A list containing a single 0

This solution has one major problem, the cardinal sin of lisp functions: it is not tail-recursive. For values of N above about 250, it gives a recursion error. So here is a tail-recursive function in 37 bytes that takes an integer, prints that many 1s, and returns 0:

(d F(q((N)(i N(i(disp 1)0(F(s N 1)))0

Try it online!

(d F(q((N)(i N(i(disp 1)0(F(s N 1)))0))))
(d F                                    ) ; Define F as
    (q(                               ))  ; a function
       (N)                                ; of one parameter, N:
          (i N                       )    ;  If N is truthy (nonzero):
                (disp 1)                  ;   Output 1 (returns nil, which is falsey)
              (i                   )      ;   If disp's return value is truthy:
                        0                 ;    0
                                          ;   Otherwise (which is always the case):
                         (F(s N 1))       ;    Recursive call with N-1
                                    0     ;  Otherwise, return 0

And here is a 40-byte tail-recursive anonymous function that returns a list, using some library functions:

(load library
(q((N)(map positive?(to0 N

Try it online!

(q((N)(map positive?(to0 N))))
(q(                         )) ; A function
   (N)                         ; of one parameter, N:
                    (to0 N)    ;  Range from N down to 0
      (map positive?       )   ;  For each, 1 if positive, 0 otherwise

Regenerate, 7 bytes

1{$~0}0

Attempt This Online!

$~0 is the first command-line argument. 1{$~0} repeats 1 that many times, and 0 adds a 0 on the end.

Ouroboros, 9 8 bytes

r+.!.!n(

Try it here! (You'll need to enter the code and input manually.)

Explanation

Due to some convenient coincidences, we can use a single snake for the program. Execution starts at the left end and proceeds to the right before looping back around to the beginning again. When the instruction pointer is on a character that gets swallowed, execution halts.

So: On the first iteration, r+ reads the input number and adds it to 0; on subsequent iterations, it pushes -1 and adds it to the existing number on the stack, decrementing it. .!.! pushes 0, then 1 if the stack number has not yet reached zero; otherwise, it pushes 1, then 0. n outputs the second of these numbers, and ( halts the program if the first is 1.

BQN, 6 bytes

∾⟜0⥊⟜1

Try it at BQN online!

Explanation

∾⟜0⥊⟜1
    ⥊⟜1  # Reshape 1 to a length given by the function argument
          # I.e. create a list of (function argument) many 1s
∾⟜0      # Append a 0 to this list

I've tried in vain to find a more interesting approach that's shorter. Most end up being 7 bytes; a few are 6 bytes:

∾⟜0⋈⊐↕  # Get indices of range(𝕩) in ⟨𝕩⟩, then append 0
«0∾⥊⟜1  # Reshape 1, prepend 0, shift left
×0∾˜⥊˜   # Reshape self, append 0, get sign of each

Try them

Given N, it's hard to make a list of length N+1 in BQN. The only builtin that does that is , but it requires its argument to be a list (thus wasting two bytes on ∘⋈), and it returns a list of lists, which is inconvenient to transform into a list of integers.

99, 69 bytes

 999
99 9 9
9999 9 99 9






 9999 999
9
999 999 9
 9 99





9 99
9

Try it online!

This can 100% be golfed but it is very confusing to golf in this language, with all the 9's and all.

The main issue is this: the only way to access loops and conditionals in this language is through its GOTO command, which will conditionally GOTO a specified line. But because variables in 99 can only hold multiples of 9, so the GOTO command can only jump to lines with line numbers that are multiples of 9. That is why there is so much empty space between certain sections of the code: it is to accommodate for the limitations of the GOTO command.

For now, I am using a GOTO for lines 9 and 18, so that the loop starts at line 9, but I feel that there is a way to cut out the GOTO to line 18 and instead have a GOTO to line 0 (making the start of the loop at line 0), I'm just not sure how to go about doing it. The reason why I don't have a GOTO for line 0 is because line 0 is 999, which takes in input and sets it to the variable 999. If the input command was no-op after reading all the input, then I could have a GOTO to line 0, but instead it reads a 0 into the variable, which messes up the entire loop.

I'm also confident that re-arranging the way I assign the variables can also save 2 or 3 bytes, but I don't see anything for now.

Minkolang, 6 bytes

1nD0u.

Try it online!

MarioLANG, 28 bytes

+>);[!:
="===#
 !:(-<
 #==="

Try it online!

Seems almost optimal, if not optimal.

PingPong, 15 bytes

;#/=\.@
1-/ \1.

Try it online!

I have another 15 bytes answer below, but I put this one at the top because I felt like this had to most golfing potential. I'm pretty confident the answer below is fully golfed using the strategies it employs.

15 bytes

;=\.@
0]\1.1-00

Try it online!

Python, 18 bytes

lambda x:"1"*x+"0"

Port of my Rust answer to Python.

Python 2, 20 bytes

-3 byte thanks to @Jonathan Allan

print'1'*input()+'0'

Attempt This Online!

Python, 27 bytes

print('1'*int(input())+'0')

Attempt This Online!

Python, 25 bytes

print('1'*int(input()),0)

Uses a less strict output format. Thanks to @ayreguitar and @None1

Attempt This Online!

Vyxal, 2 bytes

ʀ>

Try it Online!

Outputs as a list.

Explained

ʀ>ṅ­⁡​‎‎⁡⁠⁡‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁢‏‏​⁡⁠⁡‌⁣​‎‎⁡⁠⁣‏‏​⁡⁠⁡‌­
ʀ    # ‎⁡                0..x
 >   # ‎⁢[x > n for n in     ]
  ṅ  # ‎⁣join into a single string
💎

Created with the help of Luminespire.

Uiua 0.10.0, 3 bytes

0¬⊚

-1 byte thanks to @noodle man

Returns a list of 1s then a 0.

Other solutions

Just to showcase other features in Uiua and different options for output.

0=.⇡
0↯:1
⇌±⇡+1
>⇡+1.
¬⋯ⁿ:2
⇌[@0⍥@1]
0⍥&p‿1
0⍥1      #cannot be bound to a function name

jq, 9 bytes

.*"1"+"0"

Try it online!

Zsh, 19 bytes

repeat $1 <<<1
<<<0

Try it online!

TI-BASIC (TI-84+CE), 13 12 10 bytes

seq(X<Ans,X,0,Ans

This creates a list with the correct number of 1's and 0's. The byte count is subtracting any bytes that are present in an empty program. To find the byte count, I looked at the memory stats on the calculator. See how to score TI-BASIC for more information.

The input is in the form of the Ans variable, which needs to be set before running the program. Here is an example of input and output on the TI-84 Plus CE:

enter image description here

Nekomata, 2 bytes

Ħ¬

Attempt This Online!

Ħ is a new built-in in Nekomata v0.5.1, so I am using the staging version of ATO.

Ħ¬      Take 5 as an example
Ħ       Histogram; generate a list where the ith element (0-indexed) is the number of times i appears in the input
            5 -> [0,0,0,0,0,1]
 ¬      Logical NOT
            [0,0,0,0,0,1] -> [1,1,1,1,1,0]

PARI/GP, 12 bytes

n->10^n\9*10

Attempt This Online!

A function.


PARI/GP, 20 bytes

print(10^input\9*10)

Attempt This Online!

A full program.

Ruby, 12 bytes

->n{?1*n+?0}

Try it online!

PowerShell Core, 13 bytes

,1*"$input"
0

Try it online!

Outputs to stdout and is newline separated
Uses the $input variable to access stdin

,1*"$input" # generate an array of 1 of the size of $input and print it
0           # print a zero

BitCycle -u, 10 bytes

?~
v~v
>!<

Try it online!

This somehow works even though it uses some sketchy undefined behavior. It doesn't work on the Javascript online interpreter though, so it has to be modified for that interpreter:

16 bytes

?~
v~v
>v<
A/
 !

Try it online!

Brachylog, 4 bytes

⟦ṡᵐ↔

Try it online!

Unifies the output with a list, e.g. [1,1,1,1,1,0]

Explanation

⟦      Range [0, …, Input]
 ṡᵐ    Map sign: 
         The sign of positive integers is 1
         Thankfully for this challenge, the sign of 0 is 0
   ↔   Reverse the list

Piet + ascii-piet, 18 bytes (2×9=18 codels)

tabitkcmA ?cjsc aa

Try Piet online!

If we didn't have to consider the x=0 case, there is a nice 14 bytes answer:

tkvnM?esuA Q??

Try Piet online!

FreePascal, 58 B 54 B

Evidently, the output is just \$2^{x+1}-2\$ written to a base of two. This is shorter than producing the desired output iteratively.

var x:word;begin read(x);write(binStr(1<<(x+1)-2,x+1))end.

−4 B: As pointed out by dtanku, \$2^{x+1}-2 = 2^x2^1-2\$ so we pre‑evaluate \$2^1\$ and start exponentiating from \$2\$.

var x:word;begin read(x);write(binStr(2<<x-2,x+1))end.

NB: The read and its sister procedures accept all integer literals acceptable in FreePascal source code, thus $F is valid input, too.

Octave / MATLAB, 20 19 bytes

@(n)[~(1:n)+49 '0']

Try it online!

C++, 68 bytes (-9 by ceilingcat, and -1 yet again by Mukundan314)

#import<iostream>
main(int c){for(std::cin>>c;~c;)putchar(49^!c--);}

I'm…not even going to try to explain this. Ooh, XOR!

C++ (gcc), 78 bytes (-4 thanks to Mukundan314)

#include<iostream>
int main(){int c;for(std::cin>>c;c--;)puts("1");puts("0");}

Similar idea to the original, but using for loops and puts.

C++ (gcc), 82 bytes (OG)

#include<iostream>
int main(){int n;std::cin>>n;std::cout<<std::string(n,'1')<<0;}­⁡​‎‎

C++ syntax highlighting doesn't work. :(

Explanation

#include<iostream>
int main(){int n;std::cin>>n;std::cout<<std::string(n,'1')<<0;}­⁡​‎‎⁡⁠⁡‏⁠‎⁡⁠⁢‏⁠‎⁡⁠⁣‏⁠‎⁡⁠⁤‏⁠‎⁡⁠⁢⁡‏⁠‎⁡⁠⁢⁢‏⁠‎⁡⁠⁢⁣‏⁠‎⁡⁠⁢⁤‏⁠‎⁡⁠⁣⁡‏⁠‎⁡⁠⁣⁢‏⁠‎⁡⁠⁣⁣‏⁠‎⁡⁠⁣⁤‏⁠‎⁡⁠⁤⁡‏⁠‎⁡⁠⁤⁢‏⁠‎⁡⁠⁤⁣‏⁠‎⁡⁠⁤⁤‏⁠‎⁡⁠⁢⁡⁡‏⁠‎⁡⁠⁢⁡⁢‏⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠‏​⁡⁠⁡‌⁢​‎‎⁢⁠⁡‏⁠‎⁢⁠⁢‏⁠‎⁢⁠⁣‏⁠‎⁢⁠⁤‏⁠‎⁢⁠⁢⁡‏⁠‎⁢⁠⁢⁢‏⁠‎⁢⁠⁢⁣‏⁠‎⁢⁠⁢⁤‏⁠‎⁢⁠⁣⁡‏⁠‎⁢⁠⁣⁢‏⁠‎⁢⁠⁣⁣‏⁠‎⁢⁠⁤⁤⁣‏‏​⁡⁠⁡‌⁣​‎‎⁢⁠⁣⁤‏⁠‎⁢⁠⁤⁡‏⁠‎⁢⁠⁤⁢‏⁠‎⁢⁠⁤⁣‏⁠‎⁢⁠⁤⁤‏⁠‎⁢⁠⁢⁡⁡‏⁠‎⁢⁠⁢⁡⁢‏⁠‎⁢⁠⁢⁡⁣‏⁠‎⁢⁠⁢⁡⁤‏⁠‎⁢⁠⁢⁢⁡‏⁠‎⁢⁠⁢⁢⁢‏⁠‎⁢⁠⁢⁢⁣‏⁠‎⁢⁠⁢⁢⁤‏⁠‎⁢⁠⁢⁣⁡‏⁠‎⁢⁠⁢⁣⁢‏⁠‎⁢⁠⁢⁣⁣‏⁠‎⁢⁠⁢⁣⁤‏⁠‎⁢⁠⁢⁤⁡‏‏​⁡⁠⁡‌⁤​‎‎⁢⁠⁢⁤⁢‏⁠‎⁢⁠⁢⁤⁣‏⁠‎⁢⁠⁢⁤⁤‏⁠‎⁢⁠⁣⁡⁡‏⁠‎⁢⁠⁣⁡⁢‏⁠‎⁢⁠⁣⁡⁣‏⁠‎⁢⁠⁣⁡⁤‏⁠‎⁢⁠⁣⁢⁡‏⁠‎⁢⁠⁣⁢⁢‏⁠‎⁢⁠⁣⁢⁣‏⁠‎⁢⁠⁣⁢⁤‏‏​⁡⁠⁡‌⁢⁡​‎‎⁢⁠⁣⁣⁡‏⁠‎⁢⁠⁣⁣⁢‏⁠‎⁢⁠⁣⁣⁣‏⁠‎⁢⁠⁣⁣⁤‏⁠‎⁢⁠⁣⁤⁡‏⁠‎⁢⁠⁣⁤⁢‏⁠‎⁢⁠⁣⁤⁣‏⁠‎⁢⁠⁣⁤⁤‏⁠‎⁢⁠⁤⁡⁡‏⁠‎⁢⁠⁤⁡⁢‏⁠‎⁢⁠⁤⁡⁣‏⁠‎⁢⁠⁤⁡⁤‏⁠‎⁢⁠⁤⁢⁡‏⁠‎⁢⁠⁤⁢⁢‏⁠‎⁢⁠⁤⁢⁣‏⁠‎⁢⁠⁤⁢⁤‏⁠‎⁢⁠⁤⁣⁡‏⁠‎⁢⁠⁤⁣⁢‏‏​⁡⁠⁡‌⁢⁢​‎‎⁢⁠⁤⁣⁣‏⁠‎⁢⁠⁤⁣⁤‏⁠‎⁢⁠⁤⁤⁡‏⁠‎⁢⁠⁤⁤⁢‏‏​⁡⁠⁡‌­

#include<iostream>                                               # ‎⁡Imports the I/O library (char* haters be mad)
int main(){                                                   }  # ‎⁢Initiates the main() function.
           int n;std::cin>>n;                                    # ‎⁣Initializes variable n and reads it from STDIN.
                             std::cout<<                         # ‎⁤Prints things to STDOUT.
                                        std::string(n,'1')       # ‎⁢⁡This constructs a string with the char '1' repeated n times.
                                                          <<0;   # ‎⁢⁢Appends a 0 and ends the final line.
💎

Created with the help of Luminespire.

*><>, 10 bytes

Uses the -i flag to pass in input.

:?1:n?!;1-

Explanation

:           Duplicate the top value on the stack
 ?1         Add 1 to the stack if the top value isn't zero         
   :        Duplicate the top value of the stack
    n       Print the top value as a number
     ?!;    Halt execution if the top value is 0
        1-  Subtract 1 from the top value

Try it online!

JavaScript (Node.js), 25 bytes

-2 bytes thanks to @DLosc

x=>((2<<x)-2).toString(2)

Try it online!

Takes the number as the parameter to the function, then outputs the binary form of \$2^{x+1}-2\$

Brainfuck, 25 bytes (non-competing*)

-[>+<-----]>-->,[<.>-]<-.

Attempt This Online!

*: takes as input as a character-code, e.g. \x20 instead of 32.

05AB1E, 3 4 3 2 bytes

crossed out 4 is still regular 4 ;(

Ý›

+1 byte as bugfix (L results in \$[1,0]\$ for edge-case \$n=0\$)
-1 byte thanks to @lyxal
-1 byte due to a comment of OP ("Any unambiguous output format is allowed"), so it'll output as a list

Try it online.

Explanation:

Ý   # Push a list in the range [0, (implicit) input of STDIN]
 ›  # Check for each value whether the (implicit) input is larger
    # (after which this list is output implicitly as result to STDOUT)

Whitespace, 55 bytes

[S S S N
_Push_0][S N
S _Duplicate_0][T   N
T   T   _Read_STDIN_as_integer][T   T   T   _Retrieve_input_n][N
S S N
_Create_Label_LOOP][S N
S _Duplicate_n][N
T   S T N
_If_0_Jump_to_Label_END][S S S T    N
_Push_1][S N
S _Duplicate_1][T   N
S T _Print_as_integer_to_STDOUT][T  S S T   _Subtract_top_two][N
S N
N
_Jump_to_Label_LOOP][N
S S T   N
_Create_Label_END][T    N
S T _Print_as_integer_to_STDOUT]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Try it online.

Explanation in pseudo-code:

Integer n = STDIN as integer
Start LOOP:
  If (n == 0):
    Stop LOOP
  Print 1 (as integer to STDOUT)
  Go to next iteration of LOOP
Print n (which is 0 at this point) as integer to STDOUT

JavaScript (ES11), 16 bytes

-4 bytes thanks to @Unmitigated

Expects a BigInt and returns a string.

n=>10n**n/9n+"0"

Try it online!

F# (.NET 6+), 41 bytes

printf"%B"((2<<<int(stdin.ReadLine()))-2)

Most online compilers are too old (they can't format as binary), but this compiles on a proper IDE.

Haskell, 42 37 bytes

-5 bytes thanks to Wheat Wizard.

main=do n<-readLn;print$10^n`div`9*10

Try it online!

Not math, 42 bytes

main=interact(\n->('1'<$[1..read n])++"0")

Try it online!

Bash, 22 bytes

echo $((10**-~$1/9-1))

Attempt This Online!

Bash, 22 bytes

yes 1|head -n$1;echo 0

Attempt This Online!

Quipu, 32 bytes

1&0&1&/\
--[]/\
1&3&0&
>===??
\/

Attempt This Online!

Explanation

A Quipu program is composed of threads, vertical 2-character-wide strips that act as code and also as value storage. Threads are, by default, executed one at a time left to right. Each thread's value starts at 0.

Thread 0 stores the current value of the loop counter:

1&
--  # Subtract 1 from the previous value of this thread
1&  
>=  # If the result is >= 0, jump to thread 1
\/  # Otherwise, read a number and set thread 0's value to that

Thread 1 checks whether the loop counter has hit zero:

0&
[]  # Load value of thread 0
3&
==  # If the result is == 0, jump to thread 3

Thread 2 is the loop body:

1&
/\  # Output 1
0&
??  # Jump back to thread 0

Thread 3 runs after the loop exits:

/\  # Output this thread's value (0 by default)

SQL (Oracle), 31 bytes

Always fun when we can slip an SQL solution that actual isn't that bad:

select lpad(0,&n+1,1)from dual;

Knight (v2), 7 bytes

O+*,1P0

Try it online!

This answer takes full advantage of Knight's type coercion.

If you look at the code, you may notice that we seem to be multiplying (*) a list (,1) with a string (P), but due to type coercion, the second argument, which is P, is actually coerced to an integer, so this results in a list that consists of P 1's. Then, we seem to be adding the resulting list to an integer 0, but due to type coercion, the integer is coerced into a list, which, in this case, converts the 0 to a singleton list consisting of a 0. This singleton list is then concatenated at the end of the aforementioned list of 1's, resulting in a list of P 1's, followed by a single 0. Finally, O always coerces its input, which is a list, to a string, resulting in the list being joined by newline before being outputted to stdout.

JavaScript (Node.js), 18 bytes

n=>'1'.repeat(n)+0

Try it online!

JavaScript (Node.js), 19 bytes

f=n=>n?1+f(--n):'0'

Try it online!

Charcoal, 4 bytes

×1N0

Try it online! Link is to verbose version of code. Explanation: × is the repetition operator, so the string 1 is repeated according to the numeric input, and then the 0 is simply appended. Note that other ways of repeating 1 would cause it to become adjacent to the 0, which would require a separator character.

Retina 0.8.2, 7 bytes

.+
$*10

Try it online! Explanation: $* repeats a single character to its right, so the 0 does not get repeated. By default the repeat count is the entire match, which here is the input, so the input is replaced by the desired output.

Google Sheets, 13 bytes

=REPT(1,A1)&0

Pip, 6 bytes

LqP1
0

Try it online!

Perl 5 -p, 9 bytes

$_=1x$_.0

Try it online!

Jelly, 3 bytes

>ŻY

A full program that accepts a (non-negative*) integer, \$x\$, and prints \$x\$ ones followed by a zero.

* negative integers will do the same as zero.

Try it online!

How?

>ŻY - Main Link: non-negative integer, X   e.g. 0      3
 Ż  - zero range                                [0]    [0,1,2,3]
>   - {X} greater than {that}?                  [0]    [1,1,1,0]
  Y - join with newline characters
    - implicit, smashing print

Brainfuck+2, 11 bytes

;[>+:-<-]>:

Try it online

Explanation

; Input x as decimal number (only 0 to 255 are supported)
[ While x is nonzero
>+:-< Print 1
- Decrement x
]
>: Print 0

MathGolf, 3 bytes

Ä10

Try it online.

Explanation:

Ä    # Loop the (implicit) input-integer of STDIN amount of times,
     # using 1 character as inner code-block:
 1   #  Push a 1 every iteration
  0  # After the loop: push a 0
     # (after which the entire stack is joined and output implicitly as result)

APL+WIN, 6 bytes

Prompts for integer input:

⌽0,⎕⍴1

Try it online! Thanks to Dyalog Classic