[Question]
  [
# The Challenge
Write a complete program that writes twice as many bytes to standard output as the length of the program.
# Rules
* The program must write ASCII characters to the standard output.
* The contents of the output doesn't matter.
* The output, measured in bytes, must be *exactly* twice the length of the program, also measured in bytes, unless you fulfill the bonus.
* **Any trailing newline is included in the output's byte count.**
# Bonus
Your program can optionally take a number, *`n`*, as input. If so, the output must be exactly `n * program length` bytes. You can assume that *n* will always be a positive integer. If no input is provided, *`n`* must default to 2.
If you do this, you can subtract 25 bytes from your score.
Shortest program wins.
# Restrictions
* No standard loopholes.
* The program must be at least 1 byte long.
* No adding unnecessary whitespace to the source code to change its length. Similarly, comments don't count.
* Unless you fulfill the bonus, the program must accept no input. If you do fulfill the bonus, the integer must be the only input.
Lowest score (program length in bytes - bonus) wins.
The shortest answer for each language wins *for that language*.
## Leaderboards
Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
```
# Language Name, N bytes
```
where `N` is the size of your submission. If you improve your score, you *can* keep old scores in the headline, by striking them through. For instance:
```
# Ruby, <s>104</s> <s>101</s> 96 bytes
```
If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the *last* number in the header:
```
# Perl, 43 + 2 (-p flag) = 45 bytes
```
You can also make the language name a link which will then show up in the leaderboard snippet:
```
# [><>](http://esolangs.org/wiki/Fish), 121 bytes
```
```
var QUESTION_ID=59436,OVERRIDE_USER=41505;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\-?\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\-?\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
```
```
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
```
```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table>
```
  
[Answer]
# [HQ9+](http://esolangs.org/wiki/HQ9%2B), 2 bytes
```
QQ
```
outputs
```
QQQQ
```
I think it is not forbidden here.
[Answer]
# Shakespeare, 768
Yeah, Shakespeare's not much of a golfing language. Outputs 1,536 spaces.
```
Rosencrantz and Guildenstern: A Series of Tedious Events.
Rosencrantz, a count of extraordinary determination.
Guildenstern, a spacy character.
Act I: The Long Conversation
Scene I: A Tortured Friendship
[Enter Rosencrantz and Guildenstern]
Rosencrantz:
 You are a gentle, noble, valiant, loyal, loving companion.
Guildenstern:
 You are nothing!
Scene II: Asking the Hard Questions
Rosencrantz:
 Speak your mind.
Guildenstern:
 You are as fair as the sum of yourself and a daisy. Are you as
 daring as the sum of a big, bold, fiery, feisty, rough, rowdy,
 ham-fisted, hawk-eyed, broad-shouldered, bright-eyed lad and a
 large, yellow, vicious, hairy, wild, scary, long-tailed,
 sharp-clawed, small-eared lion?
Rosencrantz:
 If not, let us return to scene II.
```
# Edit: 256
Okay, I'll actually golf it. Note that the above does not compile in any existing Shakespeare implementation because I wrote it painstakingly by hand (but am prepared to defend its correctness.)
The below translates to C with one warning in spl-1.2.1, and outputs 512 spaces:
```
Ummm.Ajax,1.Puck,2.Act I:I.Scene I:A.[Enter Ajax and Puck]Ajax:You old old old old old cow.Puck:You are zero!Scene II:B.Ajax:Speak thy mind.Puck:You are the sum of you and a red cat.Are you as big as the square of me?Ajax:If not, let us return to scene II.
```
[Answer]
# Recall, 17 bytes
```
................!
```
16 NOOPs. Then the debugger `!` is invoked and dumps the memory to the console. The memory is empty, but the header is 34 bytes long:
```
-- STATE DUMP --
----------------
```
Try it [here](http://turbo.github.io/Recall/index.html?code=................!).
[Answer]
# Mathematica REPL, 1 byte
```
#
```
Prints `#1`.
[Answer]
# CJam, -17 bytes
```
r2e|i8,*
```
The source code is **8 bytes** long and qualifies for the **-25 bytes** bonus.
Try it online in the [CJam interpreter](http://cjam.aditsu.net/#code=r2e%7Ci8%2C*).
### How it works
```
r         e# Read a token from STDIN.
 2        e# Push 2.
  e|      e# Logical OR; keep the token if it's not empty, 2 otherwise.
    i     e# Cast to integer.
     8,   e# Push [0 1 2 3 4 5 6 7].
       *  e# Repeat the array the corresponding number of times.
```
[Answer]
## Python 2.6, 10
```
print`-.1`
```
Prints `-0.10000000000000001`, which is 20 chars.
Note that the string repr shows more precision. `print-.1` just gives `-.1`, and `print.1/3` gives `0.0333333333333` for only 13 digits of accuracy.
[Answer]
# [Seed](https://esolangs.org/wiki/Seed), 10 bytes
```
4 56111240
```
This compiles to the Befunge program (found by brute force)
```
9k.@
```
which produces the following 20 bytes when run (tested in CCBI, note the trailing space):
```
0 0 0 0 0 0 0 0 0 0 
```
Being unfamiliar with Befunge 98, I had to double check the spec a few times for this one:
* `k` seems pretty broken to me, executing one more time than intended due to the IP moving into the repeated instruction
* Befunge 98's stacks have infinite zeroes at the bottom
* `.` outputs as a number, followed by a space
[Answer]
# R, ~~3~~ 2 bytes
### Code
```
!0           # NOT FALSE
```
Outputs
```
TRUE
```
Wow, finally R, finally.
It seems that `{}` work too, it outputs `NULL`
## Bonus ~~33~~ 16 bytes:
### Code
```
rep(1,number*16)
```
Outputs
```
# if number is not defined
> rep(1,number*16)                     
> Error: object 'number' not found     # output is 32 (or 2*16) bytes long error
# if number is defined
> number = 3                            
> rep(1,number*16)                     # output is 16*number bytes long
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
```
[Answer]
# JavaScript, 2 bytes!
Even shorter than the 3 bytes solution:
```
!0
```
Returns `true` after running.
[Answer]
# Matlab, 8 bytes
```
1234;'5'
```
Output:
[![enter image description here](https://i.stack.imgur.com/Ly5EG.png)](https://i.stack.imgur.com/Ly5EG.png)
The output contains *`newline`*, `ans =`, *`newline`* twice, *`space`* four times, `'5'`, *`newline`*, so 16 bytes.
[Answer]
## Python 2, 11
```
print`id`*1
```
Print the string representation of the built-in `id`, which is 22 chars:
```
<built-in function id>
```
The `*1` is to get the code to 11 chars. You could also do `print id;00`.
More boring alternative 11's are:
```
print'1'*22
print 9**21
```
[Answer]
# dc, 10 - 25 = -15
```
2?A*Ar^1-n
```
Takes a blank line for "no input".
Calculates 10 ^ (10 \* n) - 1, where n is the input, or 2 if input is empty. Prints a string of `9`s of the required length.
* `2` push 2 to the stack in case input is empty
* `?` push input to the stack
* `A` push 10 to the stack (dc has shortcuts `A`-`F` for 10 - 15)
* `*` pop twice and multiply (multiply input by 10)
* `A` push 10 to the stack
* `r` reverse top two stack elements
* `^` exponentiate 10 ^ (10 \* input)
* `1-` subtract 1 from the top of stack
* `n` print with no newline.
[Answer]
# Brainfuck, 14 bytes
```
+++++++[....-]
```
This is a little mathematical exercise. Let's denote the number of `+` characters in the code by `a`, and the number of `.` characters by `b`.
The code outputs `a*b` bytes, with values from `a` down to `1` (these are non-ASCII bytes, but it seems OK according to the spec). The code's length is `a+b+3`. So we have
```
a*b = 2 * (a+b+3)
```
Trying different values for `a` and `b`, we see that the minimum for `a+b+3` is achieved for
```
a = 4       or       a = 7
b = 7                b = 4
```
[Answer]
# [gs2](https://github.com/nooodl/gs2/blob/master/gs2.py), -18 bytes
[CP437](https://en.wikipedia.org/wiki/Code_page_437): `W↕0!↨.2`
Hex dump: `57 12 30 21 17 2e 32`
`W` reads numbers from STDIN into a list. `↕0` appends a 2 to the list, and `!` extracts the first element. Then `↨.` (the list `[0,1,2,3,4,5,6]`) is repeated (`2`) this many times.
This is very similar to Dennis's CJam answer -- gs2 just combines `r` and `i` into one byte.
**Note**: I had to fix a bug in the `gs2` implementation for this to work: previously, each program had a hidden newline appended to its output, which was entirely unintentional. It only surfaced after I tried to solve this program (the language was designed for anarchy golf, which ignores trailing newlines in all problems), and I only pushed a fix to master just now, so feel free to take this answer with a grain of salt.
[Answer]
# TI-Basic, 3 bytes
```
1ᴇ5
```
Prints `100000`.
[Answer]
# [Pyth](https://www.github.com/isaacg1/pyth), ~~10~~ 9 - 25 = -16
*-1 by Dennis*
```
**N9?zvz2
```
Prints [input]\*9 quote characters, or 2\*9 if the input is empty.
**isaacg has a [shorter answer here](https://codegolf.stackexchange.com/a/59565/39328)**
# [Pyth](https://www.github.com/isaacg1/pyth), 1 byte
```
T
```
Prints `10`. It's a built in variable that initializes to 10.
[Answer]
# Perl 5, 16 bytes - 25 = -9
```
$_ =$]x($_*2||4)
```
This is an oddball approach to the problem.
Run with the `-p` command line argument.
I saw a Perl answer below that used a special variable to print more text - and thus shorten their byte count. So I used a much more verbose special variable. It prints 8 characters with a 2 character variable name. Thus, with a byte count of 16 (padded with one whitespace character to make it 16), it prints `2 * $]`, where `$]` is the Perl version printed as `5.xxxxxx`, dependent upon your Perl version. Without input it prints it four times, equaling `8*4` or `32`, which is double the byte count of the code.
I love Perl.
[Answer]
# JavaScript, 4 bytes
```
+1/0
```
Prints `Infinity`
I think this is the shortest possible JS solution without ES6 :P
[Answer]
## [Macaroni 0.0.2](https://github.com/KeyboardFire/macaroni-lang/releases/tag/v0.0.2-alpha), 23 chars
```
print tobase pow 32 9 2
```
Prints 329 in binary, which happens to conveniently turn out to be 46 characters long (it's `1000000000000000000000000000000000000000000000`), without a trailing newline.
[Answer]
# C, ~~27~~ 25
```
main(){printf("%50f",0);}
```
---
•*Thanks @Titus for knocking off 2 bytes*
  
---
# And for my *non-competing* **16 byte** solution in C, go here: <https://codegolf.stackexchange.com/a/111330/16513>
^I say non-competing because the error code could possibly depend on your compiler, Also note I'm using GCC in that solution. Also I'm not certain if it breaks rule 1 or not, I think it probably does so I went ahead and labeled it non-competing
[Answer]
# [V](https://github.com/DJMcMayhem/V), 2 Bytes
```
4é
```
This outputs
```
ÿÿÿÿ
```
[Try it online!](http://v.tryitonline.net/#code=NMOp&input=)
Explanation
This is a really hacky answer, and it works by abusing the internals of V. Essentially how it works is that `ÿ` is a command in V that signals the program is over, and any pending commands must complete. Otherwise, some implicit endings would not work, and the interpret would hang more often. This command is automatically sent several times at the end of the program, and most of the time has no effect on the output.
`é` is a command that inserts a single character. However, it does it by grabbing a raw byte, so it doesn't interpret `ÿ` as "end", it interprets it as "this is the character you need to insert." `4é` makes it insert this character 4 times instead of one.
[Answer]
# bash, 11 bytes
Here's a pleasingly ironic usage of a data compression tool :) ...
`gzip -f<<<2`
Here's a hex dump of the output (22 bytes)...
```
0000000: 1f 8b 08 00 e3 ce 32 59 00 03 33 e2 02 00 90 af  ......2Y..3.....
0000010: 7c 4c 02 00 00 00                                |L....
```
[Answer]
# JavaScript ES6, 33 - 25 = 8
```
(a=2)=>Array(a*33).fill(0).join``
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z@TWqKQZPtfI9HWSNPWzrGoKLFSI1HL2FhTLy0zJ0fDQFMvKz8zLyHhf3J@XnF@TqpeTn66RpKGoaamNRe6kF5Oal56SQaGjJEmFiG44v8A)
[Answer]
# dc, 19 - 25 = -6
```
2?19*[1n1-d0<l]dslx
```
Takes a number (2 is pushed to the stack as backup) and multiplies it by 19. Prints a `1` (no newline) and decrements the number. Loops while the number is greater than 0.
[Answer]
# C++, 80 bytes
```
#include<iostream>
int main(){int i=0;while(i<20){std::cout<<&i;i++;}return 0;}
```
note the newline character is two characters. (if you don't want it to be, change i<20 to i<=19 to get back to the same byte count.)
Sample output (will change every time)
```
0088FA0C0088FA0C0088FA0C0088FA0C0088FA0C0088FA0C0088FA0C0088FA0C0088FA0C0088FA0C0088FA0C0088FA0C0088FA0C0088FA0C0088FA0C0088FA0C0088FA0C0088FA0C0088FA0C0088FA0C
```
same 8 character memory address 20 times. 
[Answer]
# CJam, -9
```
q_,{i}{;2}?G*'X*
```
# Explanation
* `q_,`
Reads the entire input and pushes it, then pushes the length.
* `{i}{;2}?`
If the length of the input is over zero, convert it to an integer. Otherwise, pop the input and push 2.
* `G*`
Pushes 16 (the program length), then multiplies it by 2 if there is no input, or by the input.
* `'X*`
Pushes X and multiplies it by the top of the stack.
[Answer]
# [><>](http://esolangs.org/wiki/Fish), 19 + 2 (-v flag) - 25 = -4 bytes
```
l?!2f4+*v
-1o;!?::<
```
[test it here!](http://fishlanguage.com/playground/AvEKhXujhJGkPg4qz)
Thanks Cole and Sp3000
First checks the stack length, if it's 0 put 2 on the stack. Multiplies it by 21 (code length), then outputs the unicode representation of that number and decrements it by 1, loops until 0. (you'll have to inspect the output to see the characters, since the browser won't display them)
[Answer]
# JavaScript (ES5), 68 bytes - 25 bonus = 43
```
alert(Array(1+(+prompt()||2)).join(document.scripts[0].textContent))
```
(in case your browser won't allow for the snippet to run for security reasons, try this fiddle <http://jsfiddle.net/thePivottt/c3v20c9g/> )
This script only works in a browser following at least DOM3 (with `Node.textContent`) and ECMAScript 5 (or perhaps an older version). I tried to make is as standard conforming and compatible as possible. It also assumes that the script is in the first `script` element of the document.
It actually concatenates multiple copies of the script itself, which is **pretty awesome**. Note that the snippet tool on SE puts extra whitespace around the script. We could ignore that whitespace with `.trim()` but I don't find it necessary considering the program is perfect without SE's meddling. Just save this HTML5 file if you want to see it run perfectly.
```
<!DOCTYPE html>
<html>
  <head>
    <title>Minimalist HTML5 page</title>
    <script>alert(Array(1+(+prompt()||2)).join(document.scripts[0].textContent))</script>
  </head>
</html>
```
This script uses `prompt` and `alert` because `console.log` is not part of any standard, even if most modern browsers use it. If the number of repetitions passed is not a valid number or is empty, it defaults to 2. If the input is a decimal number, the program crashes due the the invalid array length.
The code uses a few interesting features of JavaScript:
* `Array(1+(+prompt()||2))`
	+ `Array(INT)` creates an Array of INT cells.
	+ `+prompt()` takes an input and turns it into a number. If we passed the input as a string, the `Array` function would simply wrap it in a one-element array.
	+ `+prompt()||2` returns the input if it is *truthy*, else it returns 2.
	+ This whole code creates an array of N empty elements, where N is one more than the amount of repetitions asked.
* `.join(document.scripts[0].textContent)`
	+ The array's `join(STRING)` method creates a string by concatenating all the cells, putting the provided STRING between values. In this program, there are N+1 **empty** elements in the array, or exactly N in-between spots. The result will be a string containing N times the provided STRING.
	+ `document.scripts[o]` is the first `<script>` element of the document.
	+ The `textContent` of `Node` instances returns the whole text found inside them and their child nodes, including scripts.
[Answer]
# Julia, 42 bytes - 25 = 17
```
print("@"^42((r=readline())>""?int(r):2))
```
This reads a line from STDIN using `readline()`. If it's empty, i.e. no input has been provided, then *n* is defined to be the input converted to an integer. Otherwise *n* is 2. We then print 42​*n* `@`s to STDOUT.
[Answer]
# Perl, 18 - 25 = -7
```
print$=x(<>*9||18)
```
The special variable [`$=`](http://perldoc.perl.org/perlvar.html#%24%3d), a.k.a. `$FORMAT_LINES_PER_PAGE`, begins its life as `60`, and therefore only needs to be duplicated half as many times as byte output needed.
]