text:
Combination bike lock
The scenario
After a long day's work slogging in the office and browsing stackexchange.com, I finally walk out the door at 16:58, already weary with the day. Because I am still only an intern, my current mode of transportation is on bicycle. I head over to my trusty Peugeot Reynolds 501, but before I can sail away on it, I need to unlock it. The lock is a standard four digit combination lock (0-9), through the frame and the front wheel. As I try to stay awake, I pull my hand up to enter in the combination.

The challenge
Because my fingers are so weary, I want to turn the lock to the correct combination with the fewest movements. One movement is defined as a rotation by one position (36 degrees), for example there is one movement from 5737 to 5738. However, I am able to grasp up to any three consecutive rings at the same time, and rotate them as one, which only counts as a single movement. For example there is also only one movement from 5737 to 6837 or to 5626. Moving from 5737 to 6838 is not one movement, as digits number 1,2 and 4 have moved in the same direction, but independently of digit number 3.
Therefore, for a given combination I can see on the bike lock (any 4-digit integer), what is the lowest number of movements I can make to get it unlocked, and yes, I can rotate in either direction at any time. By this I mean that I can turn some digits in one direction and other digits in the other direction: not all of my movements will be anitclockwise or clockwise for each unlock.
Because I am lazy, my unlock code is 0000.
This is code golf I can't be bothered writing much code, so the shortest program in number of bytes wins.
Input is from stdin, and your code should output the combinations I can see at each step after each movement, including the 0000 at the end. Each of the combinations output should be separated by a space/newline/comma/period/ampersand.
Examples
Input: 1210
0100
0000

Input: 9871
9870
0980
0090
0000

Input: 5555
4445&3335&2225&1115&0005&0006&0007&0008&0009&0000

Input: 1234
0124 0013 0002 0001 0000

I tried posting this on http://bicycles.stackexchange.com, but they didn't like it...
Disclaimer: First golf, so anything that is broken/any missing information let me know! Also I did all the examples by hand, so there may be solutions which involve less movements!
EDIT: For answers which have multiple solution paths with equal number of movements (practically all of them), there is no preferred solution.

Welcome to PPCG; very nice first challenge!

This looks solid to me! Welcome to PPCG!

[tag:path-finding] is an oddly relevant tag.

Nice challenge. Can i ask what should be the output for cases : 7478 and 3737?

It's worth noting that if your lock had real numbers written on them and we measured effort by how far we turned a combination, the answer would be writable as the minimum of the dot product of your initial state with a (finite) set of vectors.

@noisyass2 Thanks; flawr's answer gives the following: 7478
8588
9698
0708
0808
0908
0008
0009
0000
and
3737
2627
1517
0407
0307
0207
0107
0007
0008
0009
0000
Just looking at the 3737, this makes sense: Looking at the first 3 digits only: If I move all of the first three at the same time, it takes 3 movements for digits 1 and 3, and then another 4 movements for digit 2, thus a total of seven. Whereas if I move each individually, each takes 3 moves, thus 9 movements.

I'm wondering whether the title "Combination Lock" (or "Bike Lock") might attract more viewers.

I support @DavidC 's suggestion! PS: Could you please add 4826 or 6284 as test cases? These do need 12 steps, and are (according to my program) the ones who need the greatest minimum number of moves.

Couldn't decide between "Combination Lock" and "Bike Lock", so I just used both.... And flawr I don't have a working solution, but I've tried that input with a few different methods, and 12 is the best I can find; Either just moving each individually (4 + 2 + 2 + 4 = 12), or digits 1,2,3 at the same time (2), then digits 1,2 (2), then digit 2 (4), and then digit 4 (4), sum = 12. If you follow?

I would not use a so weak lock on a bike of mine! Minimum should be a U-Lock. The one here is very easy to cut with a n handheld bolt cutter!

Matlab, 412 327 bytes
Golfed (Thanks to @AndrasDeak for golfing s!):
s=dec2bin('iecbmgdoh'.'-97)-48;s=[s;-s];T=1e4;D=Inf(1,T);P=D;I=NaN(T,4);for i=1:T;I(i,:)=sprintf('%04d',i-1)-'0';end;G=input('');D(G+1)=0;for k=0:12;for n=find(D==k);for i=1:18;m=1+mod(I(n,:)+s(i,:),10)*10.^(3:-1:0)';if D(m)==Inf;D(m)=k+1;P(m)=n-1;end;end;end;end;n=0;X='0000';while n-G;n=P(n+1);X=[I(n+1,:)+48;X];end;disp(X)

This codes uses some dynamic programming for finding the shortest 'path' from the given number to 0000 using only the possible steps. The challenge is basically a shortest path prioblem (alternatively you could perhaps consider the steps as a commutatuve group.) but the difficulty was coming up with an efficient implementation. The basic structures are two 10000-element arrays, one for storing the number of steps to get to that index, the other one to store a pointer to the previous 'node' in our graph. It simultaneously calculates the 'paths' to all other possible numbers.
Examples:
9871
0981
0091
0001
0000

1210
0100
0000

Examples by @noisyass:

7478
8578
9678
0788
0899
0900
0000

3737
2627
1517
0407
0307
0207
0107
0007
0008
0009
0000

Own Example (longest sequence, shared with 6284)

4826
3826
2826
1826
0826
0926
0026
0015
0004
0003
0002
0001
0000

Full Code (inlcuding some comments):
%steps
s=[eye(4);1,1,0,0;0,1,1,0;0,0,1,1;1,1,1,0;0,1,1,1];
s=[s;-s];

D=NaN(1,10000);%D(n+1) = number of steps to get to n
P=NaN(1,10000);%P(n+1) was last one before n

I=NaN(10000,4);%integer representation as array
for i=0:9999;
    I(i+1,:)=sprintf('%04d',i)-'0';
end

G=9871; % define the current number (for the golfed version replaced with input('');
D(G+1)=0;
B=10.^(3:-1:0); %base for each digit

for k=0:100; %upper bound on number of steps;
    L=find(D==k)-1;
    for n=L; %iterate all new steps
        for i=1:18; %search all new steps
            m=sum(mod(I(n+1,:)+s(i,:),10) .* [1000,100,10,1]);
            if isnan(D(m+1))
                D(m+1) = k+1;
                P(m+1)=n;
            end
        end
    end
end
n=0;%we start here
X=[];
while n~=G
    X=[I(n+1,:)+'0';X];
    n=P(n+1);
end
disp([I(G+1,:)+'0';X,''])

Nice! Being a mostly Matlab user myself I was wondering about how well it would fare.

For input 6444 your code gives 6444
7554
8664
9774
0884
0994
0004
0003
0002
0001
0000, whereas I find the answer to be
6444
6333
6222
6111
6000
7000
8000
9000
0000. My answer is 8 steps, yours is 10. I can't see the issue, and it appears to be there in both the golfed and ungolfed version. This is fixed in your latest edit.

I just corrected a small error in the code. In s the last row should be [0,1,1,1]. Then you get a 8 step solution too! I'm sorry for the inconvenience=)

@Lui There is a matlab/octave chatroom, among other stuff it is some kind of Base for the Matlab-derived golfing languange MATL.

for 4826, i found an 11 move solution :
4826
3716
2606
1506
0406
0306
0206
0106
0007
0008
0009
0000

@noisyass2 How do you get from 0106 to 0007? =)

@flawr oh right! it skipped! arrgghhh. nvm then. back to the drawing board.

But you did make me have some uncomfortable minutes :D

APL (Dyalog Extended), 82 73 bytes
{p/⍨⍵≡¨⊃¨⊢p←({⍵/⍨⍧⊃¨⍵}⊢,⍥,(,∘-⍨↓⍉⊤5~⍨12 14,⍨⍳8)∘.{10|⍵,⍨⊂⍺+⊃⍵}⊢)⍣≡⊂⊂4⍴0}⊆

p←({⍵/⍨⍧⊃¨⍵}⊢,⍥,(,∘-⍨↓⍉⊤5~⍨12 14,⍨⍳8)∘.{10|⍵,⍨⊂⍺+⊃⍵}⊢)⍣≡⊂⊂4⍴0
p is all the possible paths
({⍵/⍨⍧⊃¨⍵}⊢,⍥,(,∘-⍨↓⍉⊤5~⍨12 14,⍨⍳8)∘.{10|⍵,⍨⊂⍺+⊃⍵}⊢)
This is a train that generates the next possible paths from one list of paths
(,∘-⍨↓⍉⊤5~⍨12 14,⍨⍳8)
List of possible changes, 0 0 0 0, 0 0 0 1, 0 0 0 -1, etc
∘.{10|⍵,⍨⊂⍺+⊃⍵}
Outer product with the dfn {10|⍵,⍨⊂⍺+⊃⍵}
{10|⍵,⍨⊂⍺+⊃⍵}
⊃⍵ unenclose ⍵ + ⊂⍺ enclose ⍺
⍵,⍨ concatenated with ⍵ 10| mod 10
⊢,⍥,stuff concatenate the output with the new paths
{⍵/⍨⍧⊃¨⍵} make it unique
(train)⍣≡⊂⊂4⍴0 apply the train with a fixpoint ⍣≡ to ⊂⊂4⍴0 to generate all paths
{p/⍨⍵≡¨⊃¨⊢p}
⊢p←... the ⊢ shouldn't be needed here, but that's a bug costing me 1 byte
⊃¨p get the first items from each in p
⍵≡¨ find where ⍵ is equal to them
p/⍨ replicate
Try it online!
Old answer:
{p⌷⍨⍸⍵≡¨⍥⊆⊃¨p←({⍵/⍨≠⊃¨⍵}⊢,⍥,((+,-)↓⍉2⊥⍣¯1⊢⎕A⍳'ABCDFGHLN')∘.{10|⍵,⍨⊂⍺+⊃⍵}⊢)⍣≡⊂⊂4⍴0}

Batch - 288 bytes
Even if you said they have to be consecutive (the rings), I assume by logic (following the example) that I can skip the middle one, as from 1234 to 0224.

set/p x=
set a=%x:~0,1%&set b=%x:~1,1%&set c=%x:~2,1%&set d=%x:~3,1%
:l
@echo %x%&if %a%==0 (if %d% NEQ 0 set/a d=d-1) else set/a a=a-1
@if %b% NEQ 0 set/a b=b-1
@if %c% NEQ 0 set/a c=c-1
@if %x% NEQ 0000 set x=%a%%b%%c%%d%&goto l

This is my Batch solution: 236 bytes.

Edit: corrected solution

set/p x=
set a=%x:~0,1%&set b=%x:~1,1%&set c=%x:~2,1%&set d=%x:~3,1%
:l
@echo %x%&set k=1&if %a%==0 (if %d% NEQ 0 set/a d=d-1&set k=0) else set/a a=a-1&set k=1
@if %b% NEQ 0 if %k%==1 set/a b=b-1&set k=0
@if %c% NEQ 0 if %k%==0 set/a c=c-1
@if %x% NEQ 0000 set x=%a%%b%%c%%d%&goto l

The new solution (fixed according to the underlying comments) is 288 bytes heavy.

I haven't looked at your answer in great depth, but I am struggling to follow your logic in the first paragraph. Which example specifically are you referring to? And your example of going from 1234 to 0224 is not one movement. The idea is that with using only two fingers I can grasp up to three consecutive rings with a single grip.

I meant, if you can move 3 consecutive rings, it's reasonable to think that you can also move the first and the third one, avoiding the second one. Or should I change my code?

Your assumption is wrong; you should change your code. Do you see the logic as explained in the above comment?

Code fixed. I checked with several different types of combinations and it looks to me like it always takes the shorter way.

This seems to only count downwards, so it takes longer than necessary for combinations with high numbers (e.g. 18 moves for 9999)

Only count downwards? Not "only" counting. And it is supposed to only change a maximum of 3 digits at a time. It must take 18 moves for 9999.

@noize what faubiguy means is in combination locks, you can rotate the numbers up or down. Which means for input 9999, should be 2 moves (not 18). 9999 0009 0000. see also example for 9871 in question.

Oh, now I get it. I'm sorry, I'll fix it now.

the space after SET/A & SET/P is also unneeded. ex. set/px= would work.

Haskell - 310 bytes
import Data.Char
import Data.List
r=replicate
h=head
a x=map(:x)[map(`mod`10)$zipWith(+)(h x)((r n 0)++(r(4-j)q)++(r(j-n)0))|j<-[1..3],n<-[0..j],q<-[1,-1]]
x!y=h x==h y
x#[]=(nubBy(!)$x>>=a)#(filter(![(r 4 0)])x)
x#y=unlines.tail.reverse.map(intToDigit<$>)$h y
main=do x<-getLine;putStrLn$[[digitToInt<$>x]]#[]

This works by repeatedly building a new list of combinations by applying each possible turn to each combination already reached until one of them is the right combination. Duplicates are removed from the list on each iteration to keep memory usage from growing exponentially.
As a brute force solution, this is very inefficient and can take several minutes to run.
I don't have much experience with Haskell, so some thing could probably be done better.

Seems like a solid basis for your approach. I've not experience with Haskell, nor (that I know of) any means of compiling/running it. A quick google doesn't give me anywhere I can try it, either. Are you able to give a link which lets me try it? Thanks.

@Lui It can be compiled with the Glasgow Haskell Compiler, but apart from downloading and using that I don't know of any way to run it.

05AB1E --no-lazy, 41 39 37 bytes
Lazy evaluation seems to break it, with it enabled, this doesn't terminate.
[TS4ã¦ŽΣmbÏD(«N>ãεISšÅ»+}T%¤O1‹i¦J»,q

Try it online!
This is really slow, doesn't finish for 1234 and 5555 on TIO.
The general structure of the program is
[           infinite loop, N in 0, 1, ...
 ...        generate list of all possible movements
    ...     take all combinations of N+1 movements and convert them to a sequence of positions
       ...  if the current position list ends with 0000, print and terminate

In more detail:
TS4ã¦ŽΣmbÏD(«     # generate a list of all possible movements
T                 # push 10
 S                # split into digits ["1", "0"]
  4ã              # take ["1", "0"] to the 4th cartesian power
                  # this generates all 4-digit combinations of 0 and 1
    ¦             # remove the first element ("1111")
     ŽΣm          # push compressed integer 20958
        b         # convert to binary
         Ï        # keep the 4-digit combinations at indices where
                  #   the binary representation of 20958 has a 1
          D       # duplicate the list
           (      # negate each number in the copy
            «     # concatenate both lists

Try T4ãʒγ€ÙO}¦€SD(« online!
N>ãεISšÅ»+}T%     # try all possible combinations of movements
 N                # push the iteration counter (starts at 0)
  >               # increment the value
   ã              # take the movement list to the N+1 cartesian power
    ε             # map over each list of N+1 moves
     IS           # push the digits of the input
       š          # prepend it to the move list
        Å»+}      # cumulative left-reduce by addition
                  # this generates all positions of the lock
                  # that are a result of the movements in the list
            T%    # modulo 10

¤O1‹i¦J»,q        # verify and print position sequence
¤                 # get the last position
 O                # sum it
  1‹              # is this less than 1? (equal to 0)
    i             # if this is the case:
     ¦            #   remove the first element (initial position)
      J»          #   join each position and positions by newlines
        ,         #   print the result
         q        #   exit

Nice, knew I'd get one-upped by a golf lang eventually

but the asker is lazy

J, 93 bytes
Doesn't even try to be efficient, will run out of memory for 5555 on TIO. :-)
(0({s#])((,-)|:#:7 59 217 584),/@((],10|(+{:))"1 2/)^:(]0=1#.s=:(4#0)&e."%.)^:_,:^:2)@(".@,.)

Try it online!

(".@,.) convert '0123' into a list like 0 1 2 3
,:^:2 list of list of steps [[0 1 2 3]]
^:(]0=1#.s=:(4#0)&e."%.)^:_ until the there is a path of moves with 0 0 0 0 in it:
((,-)|:#:7 59 217 584) the possible moves
,/@((],10|(+{:))"1 2/) for each possible move and each path: create a new path with the last move + the possible move, mod 10 appended.
0({s#]) filter out the paths that caused the loop to stop, and take the first.


text:
Build a Compiler Bomb
Introduction
You're probably familiar with zip bombs, XML bombs, etc. Put simply, they are (relatively) small files which produce enormous output when interpreted by naïve software. The challenge here is to abuse a compiler in the same way.
Challenge
Write some source code which occupies 512 bytes or less and which compiles into a file which occupies the most possible space. Largest output file wins!
Rules
OK, so there are a few important clarifications, definitions and restrictions;

The output of the compilation must be an ELF file, a Windows Portable Executable (.exe), or virtual bytecode for the JVM or .Net's CLR (other types of virtual bytecode are also likely to be OK if asked for). Update: Python's .pyc / .pyo output also counts.
If your language-of-choice can't be compiled directly into one of those formats, transpilation followed by compilation is also allowed (Update: you can transpile multiple times, just so long as you never use the same language more than once).
Your source code can consist of multiple files, and even resource files, but the summed size of all these files must not exceed 512 bytes.
You cannot use any other input than your source file(s) and the standard library of your language-of-choice. Static linking standard libraries is OK when it's supported. Specifically, no third party libraries or OS libraries.
It must be possible to invoke your compilation using a command or series of commands. If you require specific flags when compiling, these count towards your byte limit (e.g. if your compile line is gcc bomb.c -o bomb -O3 -lm, the -O3 -lm part (7 bytes) will be counted (note the initial leading space isn't counted).
Preprocessors are permitted only if they are a standard compilation option for your language.
The environment is up to you, but in the interests of making this verifiable, please stick to recent (i.e. available) compiler versions and operating systems (and obviously specify which you're using).
It must compile without errors (warnings are OK), and crashing the compiler doesn't count for anything.
What your program actually does is irrelevant, though it can't be anything malicious. It doesn't even have to be able to start.

Example 1
The C program
main(){return 1;}

Compiled with Apple LLVM version 7.0.2 (clang-700.1.81) on OS X 10.11 (64-bit):
clang bomb.c -o bomb -pg

Produces a file of 9228 bytes. The total source size is 17+3 (for the -pg) = 20 bytes, which is easily within size limit.
Example 2
The Brainfuck program:
++++++[->++++++++++++<]>.----[--<+++>]<-.+++++++..+++.[--->+<]>-----.--
-[-<+++>]<.---[--->++++<]>-.+++.------.--------.-[---<+>]<.[--->+<]>-.

Transpiled with awib to c with:
./awib < bomb.bf > bomb.c

Then compiled with Apple LLVM version 7.0.2 (clang-700.1.81) on OS X 10.11 (64-bit):
clang bomb.c

Produces a file of 8464 bytes. The total input here is 143 bytes (since @lang_c is the default for awib it didn't need to be added to the source file, and there are no special flags on either command).
Also note that in this case, the temporary bomb.c file is 802 bytes, but this counts towards neither the source size nor the output size.
Final Note
If an output of more than 4GB is achieved (perhaps if somebody finds a turing complete preprocessor), the competition will be for the smallest source which produces a file of at least that size (it's just not practical to test submissions which get too big).

If using a transpiler, does the output source code need to be under 512 bytes as well as the input source code?

@trichoplax only the original source needs to be within the byte limit. The source after transpilation can be as big as you like (the Brainfuck example has an intermediate size of 802 bytes, for example)

Is repeated transpilation allowed?

@orip interesting; I think I'll say: only if you never have to the same language more than once. So for example, Befunge -> Java -> C would be OK, but Fortran -> Java -> Fortran wouldn't.

So interpreted languages, unless transpiled, cannot be used for this challenge, correct?

@LegionMammal978 yes it has to produce one of the file types I specified. But if you think you've found something which is more virtual-machine than interpreted-language, ask about it specifically and it's possible I'll allow it (it's a bit subjective so I wanted to be very restrictive to begin, with the option of opening it up)

Python is an example of a language regarded as interpreted that compiles to bytecode.

@trichoplax speak of the devil. I was literally about to ask Dave if python compiles to one of his specified formats. Thanks!

@trichoplax I wasn't aware of that, but from some reading it looks like yes; compiling to Python bytecode absolutely counts. So for python, the output size would be the sum total size of all your pyc/pyo files. I'll update the question soon with these comment-based updates.

OK, all updated. I'm off for now (it's late in England!). I'll be back to answer any other questions tomorrow. Good luck!

A "turing-complete preprocessor" is generally not a preprocessor (step that happens before parsing) at all, but a metaprogramming system that gets executed at some point between parsing and codegen.  There are several languages that have one, or have had one grafted on in some way.

How about modifying the source code of a compiler so that anything it compiles is really big?  And then use it to compile itself....

Don't forget fork bombs, which does something similar to your CPU capacity.

@WGroleau generally in code challenges you can't use anything which was specially-built for the purpose. In fact, using anything developed since the question was posted is generally not allowed.

When you say 4GB, do you mean 4,294,967,296 bytes (4 * 2^30), or 4,000,000,000 bytes (4 * 10^9)?

@PatrickRoberts well 4GB officially means 4,000,000,000 bytes (it's GiB for 1024^3), but I can't imagine it would make a lot of difference to any answer. The rule is only there to keep things vaguely sane!

@Dave reason I ask is because of the footnote about scoring. If you're shooting for as close to 4GB as possible, then it actually matters which of the two it is.

"perhaps if somebody finds a turing complete preprocessor" Common Lisp's macros have the full language available.  It'd be easy to add a literal 4GB array to the source.

Even the humble C preprocessor is close enough to Turing complete as makes no difference. Although to be honest that says more about the utter uselessness of Turing-completeness as a real-world measurement of power than anything else (for practical engineering TC is rarely useful, and rarely even used; has more negative consequences than positive).

Related: http://codegolf.stackexchange.com/questions/8882/create-a-c-program-that-takes-the-longest-period-of-time-to-compile-in-gcc

Are only "commercially available" compilers allowed or would it be allowed to write an own compiler?

@MartinRosenau - WGroleau already asked a similar question; it's standard in coding challenges that you can use anything which already existed when the challenge began.

Why the 4GB limit? before I saw that rule, I was imagining seeing code one-liners that would create enough material to fill a data-center, which would be awesome.

@GiantCowFilms: You can still find many such solutions here, ie. ones which can be freely scaled by changing the exponent. (Eg. change the 4**7 in my original solution to 2**32, and it would theoretically generate 8 exabytes of output) As the rule mentions, it exists because no-one would be able to test solutions which fill a data-center or use a terabyte of RAM, so they would be theoretical at best. (I, for one, had problems testing my own solution, with a machine that has 16GB of RAM, even though the output is only 8.5GB, since it uses significantly more RAM than that :P)

@Dave can it be a batch file being compiled with http://www.f2ko.de/en/b2e.php ?

@Rahul2001 yes that would be allowed, but technically it would have to be a version from before Jan 11 this year (when the question was asked), which looking at the internet archive means version 2.3.4. Of course it might be tricky to get an old version, so as long as it would theoretically be about the same result on the old version, that's fine (i.e. no use of newer features).

@Dave Okay thanks... I'll see if I can get this code which I have in mind to get to work...

C, (14 + 15) = 29 byte source, 17,179,875,837 (16 GB) byte executable
Thanks to @viraptor for 6 bytes off.
Thanks to @hvd for 2 bytes off and executable size x4.
This defines the main function as a large array and initialises its first element.  This causes GCC to store the entire array in the resulting executable.
Because this array is bigger than 2GB, we need to provide the -mcmodel=medium flag to GCC.  The extra 15 bytes are included in the score, as per the rules.
main[-1u]={1};

Don't expect this code to do anything nice when run.
Compile with:
gcc -mcmodel=medium cbomb.c -o cbomb

It took me a while to get round to testing @hvd's suggestion - and to find a machine with enough juice to handle it. Eventually I found a old non-production RedHat 5.6 VM with 10GB RAM, 12GB swap, and /tmp set to a large local partition.  GCC version is 4.1.2.  Total compile time about 27 minutes.

Due to the CPU and RAM load, I recommend against doing this compile on any remotely production-related machine.

Nice. Looks like it's off to a higher start than I'd expected!

wow, 4GB already. Incidentally, I've been avoiding counting the leading space for extra arguments (to avoid ambiguity with combined flags, etc.) so you can claim +15 bytes rather than +16

does something break if you use the large mcmodel? saves a byte :)

@Sparr strangely it does for me. crtstuff.c:(.text+0x1): relocation truncated to fit: R_X86_64_32 against symbol '__TMC_END__' defined in .data section in cbomb.  Beats me.

also, I'm pretty sure {1} initializes all elements to 1, not just the first.

@Sparr Elements with missing values will be initialized to 0

Unfortunately with your latest code and GCC4.9 I get this error: /var/folders/[...].s:6:Repeat < 0, .space ignored. It looks like it's a mac issue though, so I'll test it again later when I'm on Kubuntu. (your earlier, ~1GB version is verified)

@Dave I'm testing on Ubuntu 14.04.3 with GCC 4.8.4.  Are you sure the gcc on your OSX is actually GCC?.  The default was switched to LLVM a few releases back.

I'm playing against my solution here, but... you don't need a. You can just use main[1<<30]={1};

@DigitalTrauma yeah I'm using an explicit gcc49 install. Though the default clang (masquerading as gcc) can't handle it either. I'll test it on linux tomorrow, where I expect it will be fine.

@DigitalTrauma it actually puts the 1,0,0,0,0,0.... as the contents of the main function. That is - the first instruction of main() is 00, which should fail with invalid instruction exception.

Why not use main[1<<31]={1};?

@wizzwizz4 2 reasons. 1) 4GB executable is big enough as per the question. 2) 1<<31 > MAX_INT, and thus the compiler sees it as a -ve value.

@DigitalTrauma But you could use main[(unsigned int)1<<... oh. :-/ Thanks for explaining!

Oh my. This is evil. X froze for several minutes trying to compile that code. I was starting to look for another computer to possibly ssh back in and kill the gcc process before it finally came back to life. Btw. If you want a larger value than 1<<30 then 7<<28 could be an option.

Took a few minutes, but yup - latest code is confirmed on Kubuntu.

Would mcmodel=large also work?

@Batman http://codegolf.stackexchange.com/questions/69189/build-a-compiler-bomb/69193?noredirect=1#comment168433_69193

4gb? That escalated quickly

Can you explain HOW this behaving of the compiler occurs? I would be interested in it.

In case anyone else is wondering why this compiles: http://stackoverflow.com/questions/34764796/why-does-declaring-main-as-an-array-compile

Hmm... I wonder if there are any compilers that would let you get away with switching out the 1<<X with something like 0U-1 for UINT_MAXimum carnage...

On my computer it doesn't even compile, because I have /tmp in the RAM.

@ParthianShot You can use -1u to save one more byte. GCC seems to be okay with it, but I don't have enough free disk space to tell for certain.

@the_Seppi You can use the TMPDIR environment variable to have it put temporary files elsewhere.

You could even be larger than 4GB when using a 64-bit compiler!

@hvd I finally got round to testing your suggestion - thanks!

@viraptor The Intel architecture is little-endian. The first instruction is encoded as 01 00 which is add dword ptr [eax], eax. All of the subsequent instructions encode as 00 00 which is add byte ptr [eax], al. Whether or not this seg faults will depend on eax, but it's pretty likely since no data space is defined.

can't you use mcmodel=large or small to save a byte? It still compiles.

would -1lu or even -1llu be supported?

You wouldn't be testing things at work, would you OP?

I tried this in a VM using the Ubuntu Subsystem for Windows. It kept running out of memory even though I assigned it 4GB and at no point did the entire 4GB fill up.

Python 3, 13 byte source, 9,057,900,463 byte (8.5GiB) .pyc-file
(1<<19**8,)*2

Edit: Changed the code to the version above after I realized the rules say output size beyond 4GiB doesn't matter, and the code for this one is ever so slightly shorter; The previous code - and more importantly the explanation - can be found below.

Python 3, 16 byte source, >32TB .pyc-file (if you have enough memory, disk space and patience)
(1<<19**8,)*4**7

Explanation: Python 3 does constant folding, and you get big numbers fast with exponentation. The format used by .pyc files stores the length of the integer representation using 4 bytes, though, and in reality the limit seems to be more like 2**31, so using just exponentation to generate one big number, the limit seems to be generating a 2GB .pyc file from an 8 byte source. (19**8 is a bit shy of 8*2**31, so 1<<19**8 has a binary representation just under 2GB; the multiplication by eight is because we want bytes, not bits)
However, tuples are also immutable and multiplying a tuple is also constant folded, so we can duplicate that 2GB blob as many times as we want, up to at least 2**31 times, probably. The 4**7 to get to 32TB was chosen just because it was the first exponent I could find that beat the previous 16TB answer.
Unfortunately, with the memory I have on my own computer, I could test this only up to a multiplier of 2, ie. (1<<19**8,)*2, which generated a 8.5GB file, which I hope demonstrates that the answer is realistic (ie. the file size isn't limited to 2**32=4GB).
Also, I have no idea why the file size I got when testing was 8.5GB instead of the 4GB-ish I expected, and the file is big enough that I don't feel like poking around it at the moment.

+1, but why don't (1<<19**8,)*2? 4GB is enough.

@ChristianIrwan: Yeah, I'd forgotten that rule, only realized it a few minutes ago and haven't figured out what kind of edit I should make yet. :-)

Nice. Since this is only 13 bytes, we finally have a challenger to the first-posted answer! I was only able to confirm 1<<18 on my machine (1.5GB) but I'll test it on linux later, where I expect it will work with the full 8GB (not going to try the 32TB version!)

@Dave: The exact size might depend on the version (1.5GB sounds weird no matter what, though); I was using Python 3.3.5, and used python -m py_compile asd.py to generate the .pyc-file.

@AleksiTorhamo it's small because I had to change it to 1<<18**8 instead of 1<<19**8. The full version failed with an invalid IO operation (so I'll check it on another OS & filesystem)

@Dave: Ahhh, I totally misunderstood what you meant. :P

IIRC, python uses 30 bits per 32-bit word in its integer representation

Honest question : If I run this in my terminal what will happen?

Just a 2021 update: constant folding has been fixed in current versions of Python3. I managed to reproduce the compiler bomb with python3.5 from deadsnakes PPA.

@AnshumanKumar: In Python interactive shell? If you put it into a variable (so eg. v = (1<<19**8,)*4**7), and you have enough free memory (a bit over 2GB), nothing much - it'll take a second or two to complete, and the process will use that much more memory. If you don't put it into a variable, Python will try to display the number, which means it needs to convert it to decimal first - which will take some time (and more memory) with a number that big. How long? Depends on the computer, but on the order of a year. But after that, it should finally print the multi-gigabyte output for you!

C#, about 1 min to compile, 28MB output binary:
class X<A,B,C,D,E>{class Y:X<Y,Y,Y,Y,Y>{Y.Y.Y.Y.Y.Y.Y.Y.Y y;}}

Adding more Y's will increase the size exponentially.
An explanation by Pharap as per @Odomontois' request:
This answer is abusing inheritance and type parameters to create recursion. To understand what's happening, it's easier to first simplify the problem. Consider class X<A> { class Y : X<Y> { Y y; } }, which generates the generic class X<A>, which has an inner class Y. X<A>.Y inherits X<Y>, hence X<A>.Y also has an inner class Y, which is then X<A>.Y.Y. This then also has an inner class Y, and that inner class Y has an inner class Y etc. This means that you can use scope resolution (.) ad infinitum, and every time you use it, the compiler has to deduce another level of inheritance and type parameterisation.
By adding additional type parameters, the work the compiler has to do at each stage is further increased.
Consider the following cases:
In class X<A> { class Y : X<Y> { Y y;} } type param A has a type of X<A>.Y.
In class X<A> { class Y : X<Y> { Y.Y y;} } type param A has a type of X<X<A>.Y>.Y.
In class X<A> { class Y : X<Y> { Y.Y.Y y;} } type param A has a type of X<X<X<A>.Y>.Y>.Y.
In class X<A,B> { class Y : X<Y,Y> { Y y;} } type param A is X<A,B>.Y and B is X<A,B>.Y.
In class X<A> { class Y : X<Y> { Y.Y y;} } type param A is X<X<A,B>.Y, X<A,B>.Y>.Y and B is X<X<A,B>.Y, X<A,B>.Y>.Y.
In class X<A> { class Y : X<Y> { Y.Y.Y y;} } type param A is X<X<X<A,B>.Y, X<A,B>.Y>.Y, X<X<A,B>.Y, X<A,B>.Y>.Y>.Y and B is X<X<X<A,B>.Y, X<A,B>.Y>.Y, X<X<A,B>.Y, X<A,B>.Y>.Y>.Y.
Following this pattern, one can only imagine1 the work the compiler would have to do to to deduce what A to E are in Y.Y.Y.Y.Y.Y.Y.Y.Y in the definition class X<A,B,C,D,E>{class Y:X<Y,Y,Y,Y,Y>{Y.Y.Y.Y.Y.Y.Y.Y.Y y;}}.
1 You could figure it out, but you'd need a lot of patience, and intellisense won't help you out here.

This is more like the sort of insanity I was expecting! Looks like I'm off to reinstall Mono…

Can you provide an explanation of such notorious effect?

+1 for doing more than just initializing a large array.

Here's an example using Try Roslyn and just 3 Ys.

Verified with mcs bomb.cs, but I had to add class M{static void Main(){}} to the source (still easily within the byte limit). If you have a way to compile it without a Main method please post the command! Also, 1 more .Y produces ~146MB, then ~732MB, then… I'll get back to you on the next one!

@Dave Try mcs /target:library bomb.cs

I saw this question and immediately thought of you. Nice!

There was a stackoverflow question about this - I remember reading it, but can't find it now. If you have a link, I will greatly appreciate it if you share.

@StigHemmer are classes not just large arrays? ;)

@PremierBromanov Is everything not just a large array, then?

@immibis exactly

Vladimir Reshetnikov! Good to see you here (and MSE)

@Dave You could have put static void Main(){} in X's definition. The compiler only cares that there is a suitable entry point available, it's not worried about which class it's in (though it still has to be told which suitable entry point is the one you're using).

I'm going to see how far I can take this with 16GB RAM.

Nevermind. Crashed trying with 11 Ys :D

If an output of more than 4GB is achieved (perhaps if somebody finds a turing complete preprocessor), the competition will be for the smallest source which produces a file of at least that size (it's just not practical to test submissions which get too big).

"Template Haskell" allows Haskell code to be generated at compile-time using Haskell, and is hence a turing complete pre-processor.
Here's my attempt, parameterised by an arbitrary numerical expression FOO:
import Language.Haskell.TH;main=print $(ListE .replicate FOO<$>[|0|])

The magic is the code inside the "splice" $(...). This will be executed at compile time, to generate a Haskell AST, which is grafted on to the program's AST in place of the splice.
In this case, we make a simple AST representing the literal 0, we replicate this FOO times to make a list, then we use ListE from the Language.Haskell.TH module to turn this list of ASTs into one big AST, representing the literal [0, 0, 0, 0, 0, ...].
The resulting program is equivalent to main = print [0, 0, 0, ...] with FOO repetitions of 0.
To compile to ELF:
$ ghc -XTemplateHaskell big.hs
[1 of 1] Compiling Main             ( big.hs, big.o )
Linking big ...
$ file big
big: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /nix/store/mibabdfiaznqaxqiy4bqhj3m9gaj45km-glibc-2.21/lib/ld-linux.so.2, for GNU/Linux 2.6.32, not stripped

This weighs in at 83 bytes (66 for the Haskell code and 17 for the -XTemplateHaskell argument), plus the length of FOO.
We can avoid the compiler argument and just compile with ghc, but we have to put {-# LANGUAGE TemplateHaskell#-} at the beginning, which bumps the code up to 97 bytes.
Here are a few example expressions for FOO, and the size of the resulting binary:
FOO         FOO size    Total size    Binary size
-------------------------------------------------
(2^10)      6B          89B           1.1MB
(2^15)      6B          89B           3.6MB
(2^17)      6B          89B           12MB
(2^18)      6B          89B           23MB
(2^19)      6B          89B           44MB

I ran out of RAM compiling with (2^20).
We can also make an infinite list, using repeat instead of replicate FOO, but that prevents the compiler from halting ;)

Welcome to Programming Puzzles and Code Golf. This is a brilliant answer, especially for a new user to this site. If you need any help (which I doubt), feel free to ask.

@wizzwizz4: Yeah, it is a brilliant answer.  It's essentially the same as mine, except that in Haskell it requires a special compiler directive to make the metaprogramming work. ;)

When I compile with GHC 7.8.3 I get "Not in scope: ‘<$>’" (I set the code to [...].replicate (2^10)<$>[|0|])). I'm not experienced with Haskell; any hints on how to make this compile?

Too bad template haskell isn't lazy enough to stream out an infinite executable.

Hi @Dave the <$> function is widely used in Haskell, but was only moved to the "prelude" (the set of functions available by default) in GHC 7.10. For earlier versions you'll need to add import Control.Applicative; after the exising import statement. I just tried with GHC 7.8.4 and it works.

I came here to post something exactly like this. Well done.

Cool; confirmed :)

It should be easy to make the growth here exponential here. Ben Lippmeier used to show an example on IRC which looked like: main = print x where x1 = (); x2=(x1,x1), x3=(x2,x2)... x=(xn,xn), which should be almost trivial to implement using TH. Then the file size would be proportional to 2^N (where N is FOO but optimised for code size :P) [For food measure, use !x with BangPatterns turned on, to ensure it is actually computer, if the binary doesn't end up being that big]

@Axman6 Interesting, but remember that FOO is an arbitrary Haskell expression of type Int. The linear relationship to the value of FOO is incidental: imagine if we used 2^BAR instead of FOO: that matches your proposed exponential solution without having to change the TH. We could also beat it using factorial, or Ackermann, etc.

@Axman6 A program of length L can't exceed binaries of size BusyBeaver(L). Any "boilerplate" bytes (those which aren't part of our numerical expression) don't count towards the argument of BusyBeaver, so for B bytes of boilerplate we're limited to BusyBeaver(L-B). Therefore the overwhelmingly best strategy is to minimise boilerplate (in our case, TH): no matter how smart it looks, BusyBeaver is smarter than us, and will make better use of those bytes ( https://news.ycombinator.com/item?id=9060014 ).

@wizzwizz4 don't be a patronizing asshole

@user234461 Ok, I won't be... I don't know where that came from, though; I was rubbish at golfing when I first came to this site and am still not as good as this user, so I used bold face to emphasise the compliment. https://www.xkcd.com/677/

C++, 250 + 26 = 276 bytes
template<int A,int B>struct a{static const int n;};
template<int A,int B>const int a<A,B>::n=a<A-1,a<A,B-1>::n>::n;
template<int A>struct a<A,0>{static const int n=a<A-1,1>::n;};
template<int B>struct a<0,B>{static const int n=B+1;};
int h=a<4,2>::n;

This is the Ackermann function implemented in templates.  I'm not able to compile with h=a<4,2>::n; on my little (6GB) machine, but I did manage h=a<3,14> for a 26M output file.  You can tune the constants to hit your platform's limits - see the linked Wikipedia article for guidance.
Requires -g flag to GCC (because it's all the debug symbols that actually consume any space), and a larger-than-default template depth.  My compile line ended up as

g++ -ftemplate-depth=999999 -g -c -o 69189.o 69189.cpp

Platform information
g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Linux 3.13.0-46-generic #79-Ubuntu SMP x86_64 GNU/Linux

I really like this one, but I'm not sure I can accept a .o output, since I did say ELF/.exe/etc. (and compiling this fully optimises it all out!). Still, +1 (and confirmed)

Update: As Ben Voigt points out on his answer, GCC on Linux does generate ELF files as .o output, and I've been able to confirm the <3,14> variant with it, so yup - this is valid.

I was expecting something absurd to come out of C++ templates.  I wasn't expecting the Ackermann function.

won't Fibonacci give you a smaller code and better output size control?

But we want bigger code!  Fibonacci gives almost the same size as pure linear code (but longer compile time that the linear).  You could certainly have fun with a static array of size A+B in each class, now I think of it...

Unless you are really careful, the limitation here will be template depth based.  Which means that the byte count will grow with the template depth parameter more than anything; only exponential.  Seems sad to use Ackermann to get only exponential growth.

Here's my C answer from 2005. Would produce a 16TB binary if you had 16TB RAM (you don't).
struct indblock{
   uint32_t blocks[4096];
};

struct dindblock {
    struct indblock blocks[4096];
};

struct tindblock {
    struct dindblock blocks[4096];
};

struct inode {
    char data[52]; /* not bothering to retype the details */
    struct indblock ind;
    struct dindblock dint;
    struct tindblock tind;
};

struct inode bbtinode;

int main(){}

"Would produce a 16TB binary if you had 16TB RAM (you don't)." - neither do I have a 16TB hard drive! I can't really verify this one, but it's cool nonetheless.

I discovered this one by accident and watched the compiler topple over when it ran out of address space.

In my C++ answer, I wanted to avoid doing this because you run afoul of implementation limits on size of a single object, so my templates instead generate large numbers of more reasonably-sized objects.

Please do NOT attempt to golf this entry; golfing defeats the intent of the code sample and there are no score benefits to doing so anyway. Code is already GPL'd as of 2005.

@Joshua: I wasn't golfing the entry, right now it is broken, because the first three lines define a variable, not a type.  Then the next structure fails because its member uses an incomplete type.

@Mego: See the revision history.

@Joshua: In the future when you review a suggested edit, be sure to read the explanatory comment.

@BenVoigt Regardless, editing other people's code is never acceptable here. Leave a comment if there's an issue. Relevant meta post: http://meta.codegolf.stackexchange.com/questions/1615/suggested-edits-reject-golfing

In which case, what edit did you make to my code Mego? The diff says you edited the whole thing but I can't spot any differences.

@Joshua: Check the markdown diff. Mego only added the highlighting hint.

I would assume that the 16TB of data is very very repetitive, therefor you should be able to put both a swapfile and the output file on a compressed FS and then be able to do this, but I'm not sure.

@shelvacu: The more immediate problem is the code causes the compiler to allocate 16TB RAM at once.

@Joshua That's why you also put a swapfile on the compressed FS. I'm pretty sure that would work but I'm not sure. Also possibly zram: https://en.wikipedia.org/wiki/Zram

I tried to compile it to see how fast it would lock up, i included stdint.h because it didn't know the type uint32_t. After that it compiles within the second and generates a segmentation fault when i run it.

@x13 reproducing behavior here.

the (You Don't) makes this response one that will not age gracefully with time.  I (and people of my current time period) still don't.  but at some point every one will.

@AlexBollbach: The compiler's been fixed to not require the RAM since then. But as for 16TB RAM that can't fit in current RAM physical sizes because that would make one bit smaller than one atom. It's not impossible that will be willing to make our computers big enough, but its unlikely. In addition, the actual code for this answer was for 32 bit when I first discovered it. You don't have 16 TB 32 bit RAM for a single process.

@Joshua: I'm sorry, but there's just no way that that can be correct, as there are 1TB SD cards available, and you could fit ~6 of those per one side of a RAM stick. (So clearly you can fit at least 12TB of storage in the space of a single RAM stick without hitting any fundamental physical limits, and most motherboards have more than one RAM slot) For one atom per bit, you could actually fit on the order of 100-1000TB per square centimeter (1 atom thick), or billions of TB per cubic centimeter.

ASM, 61 bytes (29 bytes source, 32 bytes for flags), 4,294,975,320 bytes executable
.globl main
main:
.zero 1<<32

Compile with gcc the_file.s -mcmodel=large -Wl,-fuse-ld=gold

The 4GB threshold means you only need 1<<30! I haven't been able to test this one yet (looks like I'm having some general issues with my gcc installation on this machine, but I'm getting _main not found linker issues with this). I'll try on linux tomorrow & upvote if I get it to work!

1<<30 is good enough for C. Since this is assembler, the size is in bytes.

Ah, makes sense.

I ran out of memory on my system. It does generate the temporary .o file (4.1G), but the linker cannot cope. (out of memory error) Someone with a lot of ram needs to try this... It does not crash the compiler though, so should still meet the rules.

@viraptor how much ram, exactly?

@viraptor My system has 32GB of RAM and for kicks I tried to build your code. as manages to hand off to ld, but ld fails with this. Not even -mcmodel=medium seems to help.

@IwillnotexistIdonotexist oh, that's disappointing. Could you try again after adding .data as the first line? (mcmodel may actually change the result in that case)

@viraptor Still no dice, but fewer linker errors this time.

try forcing use of gold linker:  gcc -fuse-ld=gold ... compiles/links... eek!  Finished in 1:29 (89 seconds) and size of 1,073,748,000 bytes.

Oops, that was the 1<<30 version, 1<<32 version takes more than 5:48, gold dies though.  Interesting...

I'm experimenting with linker scripts. I really want to get this to work :)

Did it ever finish assembling?

I finally got this to assemble on 64-bit Ubuntu 15.10, with invocation gcc -o g g.s -mcmodel=large -Wl,-fuse-ld=gold. Final tally: 4,294,975,320 bytes, with 32 extra bytes added to the program length for -mcmodel=large -Wl,-fuse-ld=gold. Worth noting that the header is incorrect; the source is 29 bytes (without the extra flags added).

By bumping the allocation up to 1<<33, I ended up with a 8,589,942,616 byte executable.

@Mego Thank you very much! I updated the description.

@viraptor I also updated the score in the title to include the necessary flags.

Confirmed with GCC on Kubuntu.

Plain old C preprocessor: 214 bytes input, 5MB output
Inspired by my real-world preprocessor fail here.
#define A B+B+B+B+B+B+B+B+B+B
#define B C+C+C+C+C+C+C+C+C+C
#define C D+D+D+D+D+D+D+D+D+D
#define D E+E+E+E+E+E+E+E+E+E
#define E F+F+F+F+F+F+F+F+F+F
#define F x+x+x+x+x+x+x+x+x+x

int main(void) { int x, y = A; }

Experiments show that each level of #defines will (as expected) make the output approximately ten times larger. But since this example took more than an hour to compile, I never went on to "G".

This is kinda like an xml bomb

Specifically it is an implementation  of the original "Billion Laughs".

This is insane yet simple.

Wow, this actually causes a segfault in GCC 4.9 and Clang. Which compiler did you use?

@Dave: gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4

@Dave: Strange. When I compile using make, it compiles, but if I type in the exact same command that make uses, it crashes. And it doesn't seem to be related to environment variables.

Ironically, the Tiny C Complier (which you would expect to fail even faster than other compilers) actually compiles this successfully in 0.131 seconds on Linux Mint 20.1 Cinnamon.

Java, 450 + 22 = 472 bytes source, ~1GB class file
B.java (golfed version, warning during compilation)
import javax.annotation.processing.*;@SupportedAnnotationTypes("java.lang.Override")public class B extends AbstractProcessor{@Override public boolean process(java.util.Set a,RoundEnvironment r){if(a.size()>0){try(java.io.Writer w=processingEnv.getFiler().createSourceFile("C").openWriter()){w.write("class C{int ");for(int i=0;i<16380;++i){for(int j=0;j<65500;++j){w.write("i");}w.write(i+";int ");}w.write("i;}");}catch(Exception e){}}return true;}}

B.java (ungolfed version)
import java.io.Writer;
import java.util.Set;

import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.TypeElement;

@SupportedAnnotationTypes("java.lang.Override")
@SupportedSourceVersion(SourceVersion.RELEASE_8)
public class B extends AbstractProcessor {
    @Override
    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
        if (annotations.size() > 0) {
            try (Writer writer = processingEnv.getFiler().createSourceFile("C").openWriter()) {
                writer.write("class C{int ");
                for (int i = 0; i < 16380; ++i) {
                    for (int j = 0; j < 65500; ++j) {
                        writer.write("i");
                    }
                    writer.write(i + ";int ");
                }
                writer.write("i;}");
            } catch (Exception e) {
            }
        }
        return true;
    }
}

Compilation
javac B.java
javac -J-Xmx16G -processor B B.java

Explanation
This bomb uses Annotation Processors. It needs 2 compile passes. The first pass builds the processor class B. During the second pass the processor creates a new source file C.java, and compiles it to a C.class with a size of 1,073,141,162 bytes.
There are several limitations when trying to create a big class file:

Creating identifiers longer than about 64k results in: error: UTF8 representation for string "iiiiiiiiiiiiiiiiiiii..." is too long for the constant pool.
Creating more than about 64k variables/functions results in: error: too many constants
There is also a limit of about 64k for the code size of a function.
There seems to be a general limit (bug?) in the java compiler of about 1GB for the .class file. If I increase 16380 to 16390 in the above code the compiler never returns.
There is also a limit of about 1GB for the .java file. Increasing 16380 to 16400 in the above code results in: An exception has occurred in the compiler (1.8.0_66). Please file a bug ... followed by a java.lang.IllegalArgumentException.

Neat; you've essentially made your own preprocessor, within the size limit, in a language with a compiler which natively supports custom preprocessors. It's within the rules. The final class was only 0.5GB for me, but I can confirm the method.

Another example in Java http://habrahabr.ru/post/245333/  - it uses nested try..finally (code in finally block is duplicated for normal and exceptional cases) and initializer block (code from initializer block is appended to each constructor)

I replaced the ä by an i and adjusted the numbers. Now the bomb should create a 1GB class on any system without any encoding issues. However, it now needs a lot more memory.

? extends TypeElement?!?

@cat See here: http://www.angelikalanger.com/GenericsFAQ/FAQSections/TypeArguments.html#Wildcards

@Victor that won't help much because method bytecode is limited to 64kb per method. To get truly large classfiles, you need to use attributes (i.e. annotations). Speaking of which, the theoretical maximum size of a classfile is around 2^65 bytes (max attribute length is 2^32+5, and you can have up to 2^16-1 attributes per field and method, and you can have up to 2^16-1 of each per class).

@Antimony described method results in ~100MB file

@Victor - I suppose if you create ~65k constructors, then you could get up to around 4gb. But to go much beyond that, you need to use attributes.

Better yet, just import java.* and javax.*

C, 26 byte source, 2,139,103,367 byte output, valid program
const main[255<<21]={195};

Compiled using: gcc cbomb.c -o cbomb (gcc version 4.6.3, Ubuntu 12.04, ~77 seconds)
I thought I'd try to see how large I could make a valid program without using any command line options. I got the idea from this answer: https://codegolf.stackexchange.com/a/69193/44946 by Digital Trauma. See the comments there as to why this compiles.
How it works: The const removes the write flag from the pages in the segment, so main can be executed. The 195 is the Intel machine code for a return. And since the Intel architecture is little-endian, this is the first byte. The program will exit with whatever the start up code put in the eax register, likely 0.
It's only about 2 gig because the linker is using 32 bit signed values for offsets. It's 8 meg smaller than 2 gig because the compiler/linker needs some space to work and this is the largest I could get it without linker errors - ymmv.

As an interesting aside, the output is 2,078,451 bytes gziped with max compression = 1029:1 compression ratio.

Boo, 71 bytes.  Compile time: 9 minutes. 134,222,236 byte executable
macro R(e as int):
 for i in range(2**e):yield R.Body
x = 0
R 25:++x

Uses a macro R (for Repeat) to cause the compiler to multiply the increment statement an arbitrary number of times.  No special compiler flags are needed; simply save the file as bomb.boo and invoke the compiler with booc bomb.boo to build it.

2**e—what is this? Try 9**e!

@WChargin: The fun thing about metaprogramming is how easily you can customize it!

I'm having a bit of trouble installing boo… I'll confirm this one when I manage to install it!

@Dave What trouble are you having with it?

Kotlin, 90 bytes source, 177416 bytes (173 KB) compiled JVM binary
inline fun a(x:(Int)->Any){x(0);x(1)}
fun b()=a{a{a{a{a{a{a{a{a{a{a{println(it)}}}}}}}}}}}

Technically, you could make this even longer by nesting the expression further. However, the compiler crashes with a StackOverflow error if you increase the recursion.

Your SI prefixes don't agree.  Is that 177416 kilobytes = 173 MB, or 177416 bytes = 173 kB?

@BenVoigt Thank you for pointing that out :D

Impressive, have a +1

For Kotlin 1.2.20 to compile we need to remove one depth and it's ~104kB. Which version did you use originally?

C++, 214 bytes (no special compile options needed)
#define Z struct X
#define T template<int N
T,int M=N>Z;struct Y{static int f(){return 0;}};T>Z<N,0>:Y{};T>Z<0,N>:Y{};T,int M>Z{static int f(){static int x[99999]={X<N-1,M>::f()+X<N,M-1>::f()};}};int x=X<80>::f();

It's a fairly straightforward two-dimensional template recursion (recursion depth goes as the square-root of total templates emitted, so won't exceed platform limits), with a small amount of static data in each one.
Generated object file with g++ 4.9.3 x86_64-pc-cygwin is 2567355421 bytes (2.4GiB).
Increasing the initial value above 80 breaks the cygwin gcc assembler (too many segments).
Also, 99999 can be replaced by 9<<19 or similar for increased size without changing the source code... but I don't think I need to use any more disk space than I already am ;)

Confirmed (in fact, it's 2.56GB with clang), but it needs a -c compile flag to stop the linker (2 extra bytes), and I'm not sure I can accept .o output (not one of the ones I listed). Still, I like it, so +1.

@Dave: gcc .o files are ELF format aren't they?

Not sure. They don't start with an ELF magic number when I generate them… I'll investigate later.

@Dave: Well, cygwin gcc isn't generating an ELF file.  Linux gcc seems to (although I'm looking at one from a different piece of code)

Yes, GCC 5.2.1 on Kubuntu is indeed generating an ELF file, but it's only 9MB! Not sure how it's managed to compress it so much compared to the other compilers. Maybe GCC 4.9 would make a 2GB ELF file.

Oh I'm missing a return statement so UB.

It won't compile to ELF without extra switches because there's no main.  Also, the .o is only 9MB on my Linux g++ as well.  But I changed 80 to 280 and now, well... it's still compiling.  It's spewing chewing up a CPU and filling the disk with an intermediate asm file.  Fun stuff!

Curiously, compiling to an ELF (g++ test.cc) produced warnings I've never seen before:
In function X<80, 79>::f()':     t.cc:(.text._ZN1XILi80ELi79EE1fEv[_ZN1XILi80ELi79EE1fEv]+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol X<80, 79>::f()::x' defined in .bss._ZZN1XILi80ELi79EE1fEvE1x[_ZZN1XILi80ELi79EE1fEvE1x] section in /tmp/ccFrtKLl.o

@phord Thats due to the compiler having to relocate segments because of the 2GB boundary for 32-bit code. Use the flag -mcmodel=medium or large if it causes issues.

Scala - 70 byte source, 22980842 byte result (after jar)
import scala.{specialized => s}
class X[@s A, @s B, @s C, @s D, @s E]

This produces 95 (about 59,000) specialized class files, which pack into a jar of about 23 MB.  You can in principle keep going if you have a filesystem that can handle that many files and enough memory.
(If the jar command must be included, it's 82 bytes.)

I could not compile it: error: java.lang.OutOfMemoryError: GC overhead limit exceeded. Could you also document the required command for compilation?

@P.Péter - You need to give the compiler more memory, e.g. scalac -J-Xmx12G X.scala is what I used.  I didn't test how much it actually needs.

still not compiling, sadly :(
error: error while loading AnnotatedElement, class file '/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar(java/lang/reflect/AnnotatedElement.class)' is broken (bad constant pool tag 18 at byte 76) one error found
Can you specify the scala and java version (maybe platform, too)? I used scalac 2.9.2 and OpenJDK 1.8.0_66-internal-b17, on debian 8 x86-64.

Ubuntu 15.10, java version "1.8.0_72-ea" Java(TM) SE Runtime Environment (build 1.8.0_72-ea-b05) Java HotSpot(TM) 64-Bit Server VM (build 25.72-b05, mixed mode) , $ scala -version Scala code runner version 2.11.7 -- Copyright 2002-2013, LAMP/EPFL

C, 284 bytes + 2 for the -c in gcc bomb.c -o bomb.o -c; output: 2 147 484 052 bytes
#define a 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
#define b a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a
#define c b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b
#define d c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c
#define e d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d
#define f e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e
__int128 x[]={f,f,f,f,f,f,f,f};

Swift for wasm, 7 byte source, 6326162 byte (6.3MB) wasm file
Not winning, but I'm adding this answer for its sheer absurdity:
print()

The Swift compiler does almost no dead code stripping (at least when compiling for wasm), so you get the entire standard library. The arguments to the print statement, any loops or recursion I added, etc barely seemed to matter. However, removing the print statement entirely shrunk the code size by a noticeable amount.
For reference, I used the wasm file generated by https://swiftwasm.org/, which seems to be using Swift 5.6 at the time of writing.

C, 54 bytes, ridiculously large executable
#include <inttypes.h>
uint64_t main[(uint64_t)~0]={~0};

Not exactly original, but much more devastating.
Inline but not portable version
unsigned long long main[~0ull]={~0};

I am NOT going to sacrifice my laptop just for this.
Explanation
uint64_t, unsigned long long, they're both unsigned 64-bit integers.
The tilde (~) is the bitwise NOT operator in C (it flips the bits of a value).
(uint64_t)0 is 0000000000000000000000000000000000000000000000000000000000000000 in binary.
By applying the bitwise NOT operator, we get a... big number (\$2^{64}-1\$).
Credits
Big thanks to user Digital Trauma for his original implementation.
This answer is really just an expansion from that.

Welcome to Code Golf, and nice first answer!

Thank you so much for the remark @AaroneousMiller !

I don't really know much about C, but I'm curious how this works.

@AaroneousMiller I've updated the post with the explanation! Feel free to ask anything about this.

how large is the output file?

Ah! It's jony! I did note that I am NOT going to sacrifice my computer for this.

Size > 2^64 bytes.  Is there any system today that can even handle such a large file?

@OskarSkog nope. but that's the entire point of this version, to be ridiculous. if we can disable the compiler's array size safeguard, this will surely crash the system, no questions asked.

main[~0ull]={3}; reduce half of size but still over2^64

Julia, 22 bytes (in memory)
0:9^9 .|>i->@eval 2^$i

Try it online!
It's quite easy to make a compilation bomb in Julia, it can easily happen accidentally. Here we use the fact that a^i has some trickery when i is a litteral integer, that allows a^2 to be turned into a*a, and a^-1 into inv(a). It means that there is a new compiled method of litteral_pow being compiled for each i. I'm pretty sure this would be at least 4GB but I don't know how to check it. This is only compiled in memory and not saved in a file though
Julia, 114 bytes (output in a .ji file)
using Pkg
pkg"generate A"
write("A/src/A.jl","module A
!(::Val{x}) where x=x
.!Val.(1:9^9)end")
pkg"dev A"
using A

(can't) Try it online!
Try A online!
To save compiled code to a file, the function must be in a package, therefore we create a package A that has the culprit (the function !). Val(i) is of type Val{i}, so a new method is compiled for each i. The output file will be in ~/.julia/compiled/<version>/A/xxx.ji
In my testing, each additional method adds at least 150 bytes (and growing, 182MB for 1M methods), which means 25M would be enough
in Julia 1.7, +2 bytes because pkg"dev ./A" is needed
Julia, 117 bytes (without writing files)
this is basically the same as the above, but with the files already there. This is slightly longer because of the uuid needed in Project.toml (this is taken care of in pkg"generate A")
file structure
A
├── src
│   └── A.jl
├── Project.toml
└── a.jl

Project.toml, 52 bytes
name="A"
uuid="8945f399-ba5e-44d3-9e17-ab2f7e467331"

src/A.jl, 47 bytes
module A
!(::Val{x}) where x=x
.!Val.(0:9^9)end

Try it online!
a.jl, 7 bytes
using A

command line options (in the A folder), +11 bytes
julia --project=. a.jl

Interesting that Julia won't produce output for a single file. Does it help that "Your source code can consist of multiple files, and even resource files, but the summed size of all these files must not exceed 512 bytes."? Looks like a chunk of the second example is just writing a file, which isn't necessary (no answers so far have needed it but the rule has been there since the start)

Myxal 0.7.1, 46 source bytes + 2 bytes flag = 48 bytes, 2.042 MB compiled
~~~~~~~y¢aaaa¢bbbb¢cccc¢dddd¢eeee¢ffff¢gggg¢hh

Simple node alias recursion bomb. Adding more aliases make the JVM complain of a too large main method.
~~~~~~~y # A bunch of filter modifiers on the element 'y'
¢a       # Alias that to 'a'
aaa¢b    # 3 'a's = 'b' and so on...
bbb¢c
ccc¢d
ddd¢e
eee¢f
fff¢g
ggg¢h
h        # Run that final 'h'

Compiled with the -O flag to disable optimization, which also disables shrinking for some reason.

Boo, way more than you can expect from this
macro R(e as int):for i in range(9**e):yield R.Body
x = 0
R 99:++x

This looks like Mason Wheeler's answer with a few small changes (??). Did you reach the same answer independently or is there something important in the values you changed (if so, please edit the answer to explain why they are important).

Rust, 42 bytes, 1.31 GB executable
fn main(){print!("{:?}",[0u8;9999999999])}

Does not require any specific compilation flags, you can just compile with rustc cbomb.rs.
Arrays of the format [x; s] where x is Copy and s has type usize and both have a value known at compile time are constructed during compilation and embedded in the binary, though the final executable is smaller than I would expect from this and I do not know what mechanism does that.
I couldn't make the size much larger than this on my laptop without LLVM or the linker crashing from non-language limitations.
Rust, 42 bytes, 18(?) EB executable (on a 64-bit system)
fn main(){print!("{:?}",[0u8;usize::MAX])}

The array would have a size of 18 EB, but the final executable would probably be smaller. I can't afford this much RAM and storage space, so I haven't been able to test this. Maybe you can if you are in the future.

PHP 7.1:
const X="x",Y=X.X.X.X.X.X.X.X,Z=Y.Y.Y.Y.Y.Y.Y.Y,A=Z.Z.Z.Z.Z.Z.Z.Z,B=A.A.A.A.A.A.A.A,C=B.B.B.B.B.B.B.B,D=C.C.C.C.C.C.C.C,E=D.D.D.D.D.D.D.D,F=E.E.E.E.E.E.E.E,G=F.F.F.F.F.F.F.F;

. is the concatenation operator, and PHP's compiler will try to do constant folding where possible, so it will construct a huge string and store it in PHP's internal bytecode. (I think you can get this written to a file with newer versions.) This is only as efficient as a classic XML entity bomb unfortunately. You'd need a few more repetitions to get to the gigabyte range.
The interesting part is that by default the worst that'll happen is seeing an error like:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 50331680 bytes) in Command line code on line 1

PHP's web-orientedness means it has a memory limit by default!

Dlang (ldc compiler)
command to build ldc -c t.d
GBS is count of gigabytes;
code of t.d:
import std;
enum GBS = 1;
void main(){
    static foreach(i; 0..2* GBS){
        mixin(text(q{static immutable a}, i,q{ = uint.max.BigInt << uint.max;}));
        mixin(text(q{a}, i, q{.writeln;}));
    }
}

Welcome to Code Golf, and nice first answer!

can you explain how this works? From the looks of it I'm guessing it's constant folding like some of the Python answers?

static immutable variables stored in binary file
and static foreach is cycle which executed in compile time.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

authors: n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Quinean Regex Tester
This challenge is pretty simple. As input, you take in a regular expression.
Then, you output a truthy/falsey of whether or not your source code matches the regular expression. It's that simple! Just two more things:

No quine builtins; you may, however, access the code's source code by file IO, etc.
This is code-golf, so shortest code in bytes wins!

Example
If your source code was say, abc, an input of a\wc would return true and an input of a\dc would return false.

Example please?

Would accessing the file/textarea in which the code is contained in count as a builtin?

@CᴏɴᴏʀO'Bʀɪᴇɴ no, that's fine.

For your example, would regex a return true or false?

I don't think just a BRE with simple character classes is specific enough. What BRE features have to be supported? 2. \d is not special in BRE; it matches the character d. 3. Choosing a specific regex flavor restricts your challenge to languages that support it, and few languages support BRE. Is that intentional?

@Dennis I'm not sure how regex's and flavours and stuff work, BRE was a name someone recommended in chat, and I kind of went with it. What do you recommend so answers don't have to worry about flavor specific features.

I'd recommend leaving it up to the answerer. If language x uses regex flavor y by default, let it use that flavor in this challenge.

@Maltysen "Use whatever RegEx is native to the language, or, BRE"

@Dennis makes sense.

Must the regex match the entire source code, or can it match a substring of the source code?

@feersum substring (unless, of course, it uses ^$)

@Maltysen Why don't you add a substring example to the question body?

Z shell, 12 bytes
grep "$@"<$0

Zsh conditionals understand only exit codes, and the scripts exits with 0 or 1 accordingly.
In addition, this prints a non-empty string (the source code) for a match and an empty one for a mismatch, which could be as truthy/falsy values in combination with test/[.
The program reads its own file, but according to this comment by the OP, this is allowed.

Aaand Dennis won. ¯\(ツ)/¯

This doesn't work. It breaks on patterns with spaces in them.

@feersum Whoops! Thanks for pointing that out. I have edited my answer.

Now it breaks if it is written to a file with spaces in the name. Or a file called -v. Or...

@BenMillwood I'd normally say don't save it with such a file name, but switching to zsh makes it bullet proof without incrementing the byte count.

I suppose you could also require the file to be called a, and then add +1 to the byte count (but $0 --> a saves that byte, so it remains at 12 bytes). Becomes more portable, but less elegant.

JavaScript (ES6), 39
(f=_=>!!`(f=${f})()`.match(prompt()))()

Just about to post this, but you beat me to it. Great job!

The beginning of your code looks like me when trying to understand this : (f=_=)

Python 3, 119 bytes
This just looks cooler, IMO (and it doesn't read the file).
(lambda i:print(bool(__import__('re').search(input(),i))))("(lambda i:print(bool(__import__('re').search(input(),i))))")

Python 3, 67 bytes
print(bool(__import__('re').search(input(),open(__file__).read())))

Added after reading this comment.

int is shorter than bool.

Julia, 64 54 bytes
r=readline;show(ismatch(Regex(r()),open(r,@__FILE__)))

Julia regular expressions use PCRE. While reading the source code of the file is a standard loophole for quines, in this case it has been explicitly allowed. Takes input with no trailing newline.

Perl, 21 bytes
open 0;$_=<0>=~$_

17 bytes plus 4 bytes for -pl0. Run like this:
echo open | perl -pl0 quinean

The source file must contain only the code above (no shebang, no trailing newline). Outputs 1 if the regex matches and the empty string if it doesn't (the empty string is falsey in Perl).

Four bytes can be saved if the input is guaranteed not to end in a newline:
open 0;say<0>=~<>

Run like this:
echo -n open | perl -M5.010 quinean

say requires Perl 5.10+ and must be enabled with -M5.010. According to Meta, "the -M5.010, when needed, is free," giving a score of 17 bytes.
How it works
This is a simple variation on the standard "cheating" quine:
open 0;print<0>

This opens the file named in $0 and reads the contents with <0>.
$_=<0>=~$_ reads one line from the source file, does a regex match against the contents of $_ (which were read by the -p flag), and assigns the result to $_. -p prints $_ automatically at the end.

Japt, 22 bytes
"+Q ³sAJ fU"+Q ³sAJ fU

Standard quine framework with a few bytes added to fit this challenge. Truthy = match(es), falsy = null. Try it online!
         // Implicit: U = input string, A = 10, J = -1, Q = quotation mark
"..."+Q  // Take this string and concatenate a quotation mark.
³        // Repeat three times.
sAJ      // Slice off the first 10 and last 1 chars.
fU       // Match U to the result.

Mathematica, 63 bytes
StringMatchQ[ToString[#0, InputForm], RegularExpression[#1]] &

Note the trailing space. Uses the standard Mma quine mechanism, and tests if it matches the regex.

Jolf, 18 15 bytes
Supports the JS flavour of RegEx, I hope that's okay. Try it here!.
 h$code.value#i

Commented:
  $code.value#      the document's element "code" (the program container)
_h            i     and output if it has (matches) the input string (i.e. regex)

In which browser does this work? Both Chrome and Firefox complain that x.step is not a function.

@Dennis Huh. I must have broken the interpreter last night. What else is wrong? I currently am unable to debug, am at school.

Good. Now add a shortcut to the document's element "code" so we can make it shorter.

@CᴏɴᴏʀO'Bʀɪᴇɴ It also gives a reference error for math.

@Dennis Ah, that's why. I forgot to update the HTML, I added math.js. I will revise when I arrive home, if that's not too late. (In about 4 ish hours)

, 14 chars / 26 bytes (non-competitive)
⟮‼(ⒸⅩ222+ᶈ0)đï

Try it here (Firefox only).
Using a version with bug fixes written after the challenge.
Explanation
⟮‼(ⒸⅩ222+ᶈ0)đï // implicit: ï=input
⟮               // copy block: copy following code for later use
 (ⒸⅩ222+ᶈ0)   // take convert 10222 to char, add stuff inside copy block
‼           đï // check if input matches resulting string
               // implicit output

NOTE: Copy blocks are NOT quine operators. They are meant to be more versatile alternatives to variable declarations.

I think you can save a byte by changing Ⅹ to 10.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Choose The Powerball Numbers!
Powerball is an American lottery that has recently gained attention because the current jackpot (as of January 11, 2016) is the largest lotto prize in history, at about $1.5 billion (USD).
Powerball players choose 5 distinct numbers from 69 numbered white balls, and 1 one "Powerball" number from 26 numbered red balls. They win the jackpot if their five white ball choices match what was drawn in any order, and if they chose the correct "Powerball" number.
So the chances of winning the jackpot are 1 in (69 choose 5)*(26 choose 1) or ((69*68*67*66*65)/(5*4*3*2*1))*26, which is 1 in 292,201,338
No one won the jackpot in the most recent drawing on January 9, 2016, but perhaps someone will win the next drawing on January 13, 2016, 10:59 pm ET.
Challenge
Write a program or function that simulates a Powerball drawing, taking no input but outputting 5 distinct random numbers from 1 to 69 inclusive, and then one random "Powerball" number from 1 to 26 inclusive (which could be a repeat of one of the 5 initial numbers).
The "Powerball" number should always be the last number in the output, but otherwise the order of the first 5 numbers does not matter.
The 6 numbers should be output in decimal, either space separated or newline separated, with an optional single trailing newline. Commas, brackets, and other characters are not allowed in the output.
So these would be  valid outputs (using the numbers from the last drawing):
32 16 19 57 34 13
32
16
19
57
34
13
All 292201338 possible outcomes should be possible with uniform probability. You may use built-in pseudo-random number generators and assume they meet this standard.
Here is an ungolfed reference implementation that works in Python 2 or 3:
import random
print(' '.join(map(str, random.sample(range(1,70), 5) + [random.randint(1, 26)])))

The shortest code in bytes wins.

Note that I have no affiliation with Powerball and don't really suggest that you play. But if you win anything from numbers generated by one of the programs here, I'm sure we'd love to hear about it. :D

Missed opportunity to demand a share of the winnings should someone here get the jackpot.

Do the 5 numbers have to be in order?

@Neil "The "Powerball" number should always be the last number in the output, but otherwise the order of the first 5 numbers does not matter."

I'm sure no one is confused, but you actually mean integers in the challenge.

Some proposed "solutions" would appear to a substantial likelihood of including duplicates in the output; that should of course be forbidden.

@supercat The "Powerball" can be a duplicate of one of the others. The first 5 numbers should be unique.

Can a function return a list of values? Also can the first 5 be in a sub list, followed by a single value for the Powerball?

@BradGilbertb2gills No. "The 6 numbers should be output in decimal, either space separated or newline separated, with an optional single trailing newline. Commas, brackets, and other characters are not allowed in the output." I'll allow returning the string instead of printing it though.

Why are you dividing by (5*4*3*2*1)? That part makes no sense... Why take it out? It should be 1 in 35,064,160,560 ((69*68*67*66*65) x (26))

@CanadianLuke The order of the first 5 numbers does not matter. There are 5! = 5*4*3*2*1 ways to arrange 5 things, so you factor that out.

Ahhh I understand now. I was thinking of the formula for being in order

@Calvin'sHobbies, is ans = OK in MATLAB? You said program or function, and by default ans = is accepted for functions but your wording makes me wonder.

@StewieGriffin That's ok

Dyalog APL, 10 bytes
(5?69),?26

Dyadic ? is ⍺ distinct random numbers in [1,⍵], and monadic ? is a single random number.
Try it here.

Almost identical in J except you have to add 1 because of the 0 based indexing: 1+(5?69),?26.

CJam, 16 bytes
69,mr5<26mr+:)S*

69,   range(69)
mr    shuffle the generated array
5<    first 5 elements
26mr  random number 0..25
+     concat to array
:)    increment each array element
S*    join with spaces

Try it online.

I like how :) makes things just a little bigger, like how a stranger's smile can make you just a little happier.

I think I'd be pretty :) if I won the lottery. +1

MATL, 10 bytes
69 5Zr26Yr

Uses current version (9.2.0) of the language/compiler.
Example
With compiler run on Matlab:
>> matl
 > 69 5Zr26Yr
 >
66
59
64
56
29
12

With compiler run on Octave:
>> matl
 > 69 5Zr26Yr
 >
2 69 41 44 23
22

The first five numbers are separated by space, not by newline. This is due to Octave's underlying randsample function behaving differently from Matlab's (and has been corrected in a new version of the compiler). Anyway, newline and space are both allowed by the challenge.
Edit (April 4, 2016): Try it online!
Explanation
69 5Zr    % randsample(69,5), without replacement by default. Gives a 5x1 column vector
26Yr      % randi(26). Gives single number
          % implicit display

See relevant Matlab functions: randsample and randi.

Ruby, 33 32
p *[*1..69].sample(5),rand(26)+1

Ruby happens to have a built-in method, sample, that selects random values from an array without replacement. Thanks to QPaysTaxes for pointing out that I don't need the parens.

Are you sure you need the parentheses? I think you could trim off a byte by dropping ten and having a space between p and *. I'm checking now. EDIT: tested and AFAICT it works.

Ha, it does, thank you. I'd been testing in an irb instance where I'd assigned to p at some point, which actually breaks the syntax parsing for that version.

PowerShell v2+, 31 27 bytes
1..69|Random -c 5;Random 27

Requires version 2 or newer, as Get-Random wasn't present in v1 (the Get- is implied, and -Maximum is positional). Output is newline separated.
Ungolfed:
Get-Random -InputObject (1..69) -Count 5
Get-Random -Maximum 27

Random -ma 27 can just be Random 27 as -Maximum is matched by position 0

@Matt Thanks - I forgot that.

Octave, 35 32 bytes
Calvin's Hobbies confirmed that ans = was OK when using a function, so:
@()[randperm(69)(1:5),randi(26)]

It has similarities to Memming's answer, but it uses direct indexing that's only possible in Octave, and it's 5 7 bytes shorter, so I figured it was worth posting anyway.
randperm(69) creates a list with a random permutation of the numbers 1-69. It's possible to directly index the list (not possible in MATLAB) to only get the first 5 numbers like this (1;5). The list is followed by randi(26) which returns a single number between 1 and 26.
Old:
disp([randperm(69)(1:5),randi(26)])

The resulting list is displayed using disp.

R, 30 29 bytes
cat((s=sample)(69,5),s(26,1))

The sample function performs simple random sampling from the input. If a single integer is given as the first argument, sampling is done from 1 to the argument. The sample size is the second argument. We're employing the default option of sampling without replacement.
Try it online

you can save two whole bytes by using c instead of cat

@DeanMacGregor Thanks for the suggestion, but submissions here must be either full programs that write to STDOUT or functions that return a value. In this case I've opted for the former. If I were to use c, this would only be a snippet, which isn't allowed by default.

Ahh I see.  I'm not an avid golfer so I wasn't familiar with that.

@DeanMacGregor No problem. Thanks anyway for the suggestion. :)

Python 3.5, 63 bytes
from random import*
print(*sample(range(1,70),5),randint(1,26))

It's basically the reference implementation golfed. Note that 3.5 is necessary to splat in a non-last argument.

Shell + coreutils, 31
shuf -i1-69 -n5
shuf -i1-26 -n1

C#, 153 bytes 140 bytes
Thanks to "McKay":
string.Join(" ",Enumerable.Range(1,69).OrderBy(e=>Guid.NewGuid()).Take(5).Concat(Enumerable.Range(1,26).OrderBy(e=>Guid.NewGuid()).Take(1)))

153 bytes solution:
string.Join(" ",Enumerable.Range(1,69).OrderBy(e=>Guid.NewGuid()).Take(5))+" "+string.Join(" ",Enumerable.Range(1,26).OrderBy(e=>Guid.NewGuid()).Take(1))

Simple solution using Linq and shuffling using GUID.

Don't need the string join in the powerball number portion and you'd save bytes either caching the order by delegate or a lot more by using random for the powerball number

And if you concat the sequences instead of string concatenation, you don't need to specify the space3 times, it would be more efficient as well. e.g. string.Join(" ", ....take(5).Concat(....Take(1)))

MATLAB, 40
x=randperm(69);disp([x(1:5) randi(26)])

I know. It's the boring solution.

PHP, 69 bytes
<?foreach(array_rand(range(1,69),5)as$k)echo$k+1," ";echo rand(1,26);

Pretty straight forward answer. Generate a 1-69 range, then use array_rand to grab 5 random keys from the array, and echo out the $k+1 value (0-indexed), then echo a random int from 1-26.

Pyth - 13 14 13 bytes
Major golfing possible, this was just a FGITW.
jb>5.SS69hO26

Try it online here.

Could you explain the code so it can be checked that it's really uniform?

You can change the <... 5 to >5.... Final code jb>5.SS69hO26

Mathematica, 64 bytes
StringRiffle@Append[Range@69~RandomSample~5,RandomInteger@25+1]&

Quite simple.

The output has braces and commas.

-1 invalid for above reason

StringJoin=""<>##&

@CatsAreFluffy Actually fixed this time. Just mixed up my functions...

I think you could shorten it if you only use Range/RandomSample and transposed it over two lists instead of using RandomInteger.  Something like RandomSample[Range[#1],#2]&@@@{{69,5},{26,1}}]

Brachylog, 40 bytes
1:5e,68{I`random(I)+1=Z`Z=w,"
"w}\;25:1&

Explanation
Brachylog doesn't have a built-in for random numbers (yet...) so we have to use an SWI-Prolog predicate for that: random/1. We can input SWI-Prolog code in Brachylog using backquotes.
1:5e,                             \  § Enumerate from 1 to 5 using \ (backtrack), which
                                     § evaluates to false and thus constructs a loop

     68{                         }   § Declare sub-predicate 1 and call it with 68 as input

        I`random(I)+1=Z`             § Z is the arithmetic expression 'random(I) + 1' where
                                     § I is the input of the sub-predicate

                        Z=w,         § Evaluate Z and write it
                            "\n"w    § Write a new line

;                                    § Else (we will reach this after the 5th iteration of
                                     § the enumeration, since \ is always false)

25:1&                                § Call the sub-predicate 1 with 25 as input

JavaScript (ES6), 106 86 84 bytes
F=(s=new Set,r=Math.random)=>s.size<5?F(s.add(r()*69+1|0)):[...s,r()*26|0+1].join` `

Since we can't uniquely sample randoms in JavaScript, this works by creating a Set (which only holds unique values), recursively adding randoms (1-69) until there are 5 unique ones, appending a random number (1-26), then joining and returning it all out.

Ruby, 47 43 39 bytes
puts *(1..69).to_a.sample(5),rand(26)+1

I think it can be golfed more, but I'll work on that once I'm done admiring how pretty this code looks, considering.
It works pretty much the same way as everything else: Take an array of the numbers 1 to 69, shuffle them, get the first five, output those, then output a random number between 1 and 26.
I went through a few iterations before posting this:
puts (1..69).to_a.shuffle.first(5).join(' ')+" #{rand(26)+1}"  #61
puts (1..69).to_a.shuffle[0..5].join(' ')+" #{rand(26)+1}"     #58
puts (1..69).to_a.shuffle[0..5].join('<newline>'),rand(26)+1   #52
puts *('1'..'69').to_a.shuffle[0..5],rand(26)+1                #47
puts *('1'..'69').to_a.sample(5),rand(26)+1                    #43

(where <newline> is replaced with an actual newline)
EDIT: Whoops, didn't see the preexisting Ruby answer. I stumbled on sample and was scrolling down to edit my answer, but then I saw it... Oh well. My final score is 43 bytes, but I'll keep golfing a little to see how well I can do.

Elixir, 83 Bytes
Enum.reduce Enum.take_random(1..69,5)++[Enum.random(1..26)],fn(x,a)->"#{a} #{x}"end

When just IO.putsing an array of integers, Elixir will interpret the integers as characters and therefore output some string instead of the desired powerball numbers. So, we have to reduce the integer array down to a string.

PARI/GP, 71 70 bytes
apply(n->print(n),numtoperm(69,random(69!))[1..5]);print(random(26)+1)

It generates a random permutation of [1..69], then takes the first 5.
Unfortunately this is an inefficient user of randomness, consuming an average of 87 bytes of entropy compared to the information-theoretic ideal of 3.5. This is mainly because the entire permutation is generated instead of just the first 5 members, and also because the perms are ordered (losing lg 5! =~ 7 bits). Further, random uses a rejection strategy rather than using arithmetic coding. (This is because PARI uses Brent's xorgen, which is fast enough that the overhead from more complicated strategies is rarely worthwhile.)
There are three 'obvious' changes which do not work under the current (2.8.0) version of gp. random and print could be stored in variables, and print could be called directly rather than via the anonymous -> function:
r=random;apply(p=print,numtoperm(69,r(69!))[1..5]);p(r(26)+1)

Together these would save 9 bytes. Unfortunately both functions are valid without arguments, and hence are evaluated immediately rather than stored, so these do not compute the desired output.

Perl 5, 59 bytes
{say for(sort{-1+2*int rand 2}1..69)[0..5];say$==1+rand 25}

It's a subroutine; use it as:
perl -M5.010 -e'sub f{...}f'

You can use -E instead of -M5.010 -e

Cant you can replace -1+2*int rand 2 with rand>.5?1:-1?

And shouldn't you be able to save another few by replacing ;say$== with ,$==

@dev-null Thanks! The -M5.010 doesn't count anyway so I didn't bother abbreviating it. I think I tried a comma instead of another say and it didn't work. But the new sort rule is a good idea, thanks. I'll test it when I have a chance and edit it in.

PHP, 65 bytes
<?=join(' ',array_rand(array_flip(range(1,69)),5))." ".rand()%26;

Thanks to the other PHP answer on this page. I wrote up a program on my own, and it turned out to be the exact same answer as the one written by Samsquanch, which drove me to take it a step further to save a few bytes.
If anyone can figure out a way to append one array to another in here that's less than the 5 bytes it takes me to join the powerball number on after, I would greatly appreciate it, cause it's driving me nuts! The best I could come up with would be after array_rand and before join, having a statement something like +[5=>rand()%25], but that's an extra byte over just concatenating it on after.
<?=                                                              // This represents an inline 'echo' statement
                                  range(1,69)                    // Get an array of all numbers from 1 to 69 inclusive
                       array_flip(           )                   // Swap the keys and values.
            array_rand(                       ,5)                // Get a random subset of five keys.
   join(' ',                                     ).rand()%26     // Concatenate the array with spaces, along with the powerball number

Run it through the command line. Sample:
C:\(filepath)>php powerball.php

Output:
 12 24 33 67 69 4

Intel x86 Machine code, 85 bytes
¿I ±‰ø1Ò»E ÷óB‰Ðè+ ‰þÑç÷ƒÇþÉ„Éuâ‰ø1Ò» ÷óB‰Ðè
 0äÍ¸ Í±ëÆÔ
00†Äˆã´ÍˆØÍ° ÍÃ

Well it does sometimes print the same numbers if so, just try again by pressing a key.
Compile with:
nasm file.asm -o file.bin

Make sure to align it to a floppy size (add zeros at the end) in order to mount it to a vm (it does not need any operating system).
Disassembly:
BITS 16
ORG 0x7c00

mov di,73 ;starting seed
mov cl,5 ;we need five numbers

loop:

mov ax,di

xor dx,dx
mov bx,69
div bx
inc dx
mov ax,dx

call print_rnd_number

mov si,di
shl di,1
add di,si
add di,7

dec cl

test cl,cl
jne loop

mov ax,di

xor dx,dx
mov bx,26
div bx
inc dx
mov ax,dx

call print_rnd_number

xor ah,ah
int 0x16
mov ax,0x0002
int 0x10
mov cl,5
jmp loop

print_rnd_number:
aam
add ax,0x3030
xchg al,ah
mov bl,ah
mov ah,0x0E
int 0x10
mov al,bl
int 0x10
mov al,' '
int 0x10
ret

Welcome to Programming Puzzles & Code Golf! Seeing machine code is always impressive, but if it prints repeated numbers on occasions, I'm afraid your submission is invalid.

Yes it is but I just wanted to share this :)

I understand, but we recently discussed this, and the community's consensus was that invalid answers should either be fixed or removed.

I'll undownvote if you fix; please ping me.

C, 142 bytes
i,x[6],n;main(j){for(srand(time(0));i<6;n-i?0:printf("%d ",x[i]),i++)for(x[n=j=i]=(69-i/5*43)*(rand()/2147483647.)+1;i<6&&j--;)i-=x[i]==x[j];}

Not terribly happy with this solution as it feels like there should be more golfing opportunity. I'll look at it again tomorrow with fresh eyes. Try it here.

Swift, 165 bytes
import UIKit;var a=[Int]();for i in 0...5{func z()->Int{return Int(arc4random_uniform(i<5 ?68:25)+1)};var n=z();while i<5&&a.contains(n){n=z()};a.append(n);print(n)}

Can quickly be run in an Xcode Playground.
EDIT: Current problem here is that it's theoretically possible for this to run forever in the while loop if arc4random_uniform somehow keeps pulling the same number. The odds of that happening, for any significant length of time, are probably better than the odds of winning the Powerball.

How does it guarantee that there won't be any duplicated values?

@supercat, it didn't before, but now it does.

Perl 6,  32  31 bytes
# space is necessary so that the parens denote a list
# rather than being part of the call to `put`
put (pick(5,1..69),(1..26).pick) # 32 bytes
# 25 35 57 67 62 24␤

Turning it into a function that returns a string, I can remove 4 bytes (put␠) while only adding 3 ({~ })
{~(pick(5,1..69),(1..26).pick)} # 31 bytes

Usage:
say {...}().perl; # use .perl to prove it returns a string
# "25 35 57 67 62 24"

If a function were allowed to return a list of the values, the following would also work.
( Otherwise it would be the same as above but within { } )

function that returns a single flat list
{|pick(5,1..69),(1..26).pick} # 29 bytes
# (25,35,57,67,62,24)

function that returns a list with the first 5 numbers in a sub list
{pick(5,1..69),(1..26).pick} # 28 bytes
# ((25,35,57,67,62),24)

function that returns a list with the first 5 in a sub list, and the Powerball in another sub list
{pick(5,1..69),pick 1,1..26} # 28 bytes
# ((25,35,57,67,62),(24,))

Seriously, 35 bytes
My first attempt at an answer in a golfing language.
Feels longer than it should have to be.
The repetition could likely be removed with W, but it seems to be broken in the online interpreter and I don't want to post untested code.
Too bad { doesn't work on lists.
Code:
:70:1xi J{. J{. J{. J{. J{.:26:Ju.

Hex dump:
3a37303a317869204a7b2e204a7b2e204a7b2e204a7b2e204a7b2e3a32363a4a752e7f

Explanation:
:70:1x                       # Push a list of the numbers 1-69
i                            # Explode list
 J{.                         # rotate stack random(len(stack)) times and pop/print
 J{. J{. J{. J{.             # same thing 4 more times
:26:Ju.                      # print random number in 1-26
                             # (7F) unprintable, terminate without explicit printing

Online interpreter

Lua, 96 Bytes
A simple solution, using a table as a set by putting the value inside it as table[value]=truthy/falsyto be able to check if they are inside it or not.
I lose 5 bytes because I have to set the first value of my table, else I won't go inside the while(o[n])loop and will simply output n before using the random function. As Lua uses 1-based tables, I also have to force it to put its first value to the cell [0], otherwise I couldn't output a 1.
m,n,o=math.random,0,{[0]=0}for i=1,5 do while(o[n])do n=m(69)end o[n]=0 print(n)end print(m(26))

Ungolfed:
m,n,o=math.random,0,{[0]=0}
for i=1,5
do
  while(o[n])
  do
    n=m(69)
  end
  o[n]=0
  print(n)
end
print(m(26))

C++, 252 bytes

Golfed:
#include<iostream>
#include <random>

int main(){std::random_device rd;std::mt19937 gen(rd());std::uniform_int_distribution<> dis(1,69);for(int c=0;c<=5;c++){std::cout<<dis(gen)<<" ";}int x=dis(gen);while(x>26||x<1){x=dis(gen);}std::cout<<x;return 0;}

Ungolfed:
#include<iostream>
#include <random>

int main()
{
    std::random_device rd;
    std::mt19937 gen(rd());
    std::uniform_int_distribution<> dis(1, 69);
    for(int c = 0; c <= 5; c++){
        std::cout<<dis(gen)<<" ";
    }
    int x = dis(gen);
    while (x > 26 || x < 1){
        x = dis(gen);
    }
    std::cout<<x;
    return 0;
}