text:
Goodbye Cruel World!
Background
Hello golfers! I would like to learn all the programming languages! But I kinda have a short attention span... and copying all the Hello World examples gets boring... but I like fire! ^w^
Challenge
So here is the plan! I want you all to write  the smallest code that will compile, print Goodbye Cruel World!, and then crash. Or, as a bonus twist challenge, print Hello World! and crash with Goodbye Cruel World!
Rules

Your score will be total character count used. The answer must be a whole executable program.
Your program must print Goodbye Cruel World! to output, and then crash (unexpected error).

For a score bonus, you must print Hello World! to output instead, but the error message must also contain Goodbye Cruel World!. If you complete the bonus challenge, you may divide your score by 2. (Include a ! at the end of your score if you are claiming the bonus!)

As long as the standard output still prints, and standard error still prints, the order doesn't matter. Just as long as neither can block the other from happening.
The output must contain the contents of the above; " shouldn't appear in the output.
The output should contain the specified string, and nothing else.
The crash report can contain anything, but to claim the bonus, the following regex should match /Goodbye Cruel World!/mi (aka, contains, ignore case/surrounding text))
The strings Hello World! and Goodbye Cruel World! are case insensitive, but otherwise should appear exactly as above.
If the language is capable of crashing (it cannot change its exit code), it needs to crash. Otherwise use the standard "error report" (i.e., STDERR) for the language.

I can crash Python 3, so I have included an example Python 3 answer! Now lets all set the world on fire! ^W^

var QUESTION_ID=125282,OVERRIDE_USER=0;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+r.match(SCORE_REG)[0],language:r.match(LANG_REG)[0].replace(/<\/?[^>]*>/g,"").trim(),link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/\d+((?=!?$)|(?= Bytes))/i,OVERRIDE_REG=/^Override\s*header:\s*/i;LANG_REG=/^[^,(\n\r\|]+/i
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/Sites/codegolf/all.css?v=617d0685f6f3">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

Comments are not for extended discussion; this conversation has been moved to chat.

as a bonus twist challenge, print "Hello World!" and crash with "Goodbye Cruel World!"?

Suppose I'm working in a language like Java, where STDOUT and STDERR are, of course, printed in different threads. This means that, although the program, in order, prints "Hello world" and then crashes, it is possible that the stack trace will be printed first... Is that allowed?

@SocraticPhoenix As long as STDOUT still prints, and STDERR still prints, the order doesn't matter. Just as long as neither can block the other from happening.

@Tezra okay... java's still really long because of boilerplate

@carusocomputing print "Hello World!" to STDOUT and print "Goodbye Cruel World!" to STDERR when you crash

@StephenS I meant explain what a "bonus twist challenge" is, not what he was asking for.

@carusocomputing That is further explained in the rules. For a score bonus, you must print "Hello World!" to output instead, but the debug must also contain "Goodbye Cruel World!". If you complete the bonus challenge, you may divide your score by 2. (Include a ! at the end of your score if you are claiming the bonus!)

@carusocomputing it is an optional bonus challenge to strive for.

Does it actually have to crash, or can it just output to STDERR?

@pycoder If the language is capable of crashing (Exit code != 'OK'), it needs to crash. Otherwise use the standard 'error report' (STDERR) for the language.

The "output box"? The "debug field"? Are we supposed to guess what IDE you use and use the same one?

@PeterTaylor remnant from previous wording. Use Where ever STDOUT and STDERR go to (or is) in your language.

So you must print "Goodbye Cruel World" to STDERR (possibly along with other text) and then have a nonzero exit code?

@CalculatorFeline to STDOUT then crash. STDERR only matters if you go for the bonus challenge. (Please use @ Tezra in the chat at the top of the comments for further clarifications)

This is so much fun, I can't stop making solutions!

@Adám Thanks! That is part of my goal with my challenges. To be simple, easy, but fun. ^w^

Can your program print extra text?

@ericw31415 Only if that is part of the error output.

This has a bonus, and thus is code-golf. See here.

@Riker Did you mean to say "is not code-golf"? I think it still is, as the bonus is just an optional, harder version. The bonus modifier is just to make it viable as the preferred solution. My other options are post as separate question (would be closed as a dup), or use a different tag (which, at the end of the day, this is just 2 different difficulty code-golf challenges together, so doing that would defeat the point of the code-golf tag). For any rule, there will always be a good exception (I think this use case counts as one) And no one here seems bothered by it.

@Tezra yes, sorry for the typo. And you're right, bonuses are intended to make an alternate solution viable. However, in this case, it's almost always shorter to include the HW part. Printing HW doesn't take as many characters as the goodbye, so it's pretty much guaranteed a bonus solution will be shorter in any given language.

The leaderboard isn't working because of the answer formatting.

Related

Does Goodbye Cruel World have to go to STDERR even if Hello World is not included?

@Titus It goes to STDOUT (or an equivalent); unless you do the bonus challenge which does require Goodbye Cruel World in the error output.

Reminds me of C For Dummies.

C, 43 bytes
main(){puts(puts("Goodbye Cruel World!"));}

Prints the string and then tries to use the return value as a pointer to another string to be printed, which causes a segmentation fault.
Try it online!
C, 42 bytes
Thanks to @Ruslan!
main(i){i=puts("Goodbye Cruel World!")/0;}

Try it online!
Just for fun: C (on 64-bit Linux), 149 bytes
Modified from this Hello World -program here.
const int main[]={-443987883,440,113408,-1922629632,4149,1358336,84869120,15544,266023168,1869563654,1702453860,1970422560,1461742693,1684828783,33};

Try it online!

main(i){i=puts("Goodbye Cruel World!")/0;} strips one byte off.

@Ruslan Thanks. I initially had i;f(){i=puts("Goodbye Cruel World!")/0;}, but f(){puts(puts("Goodbye Cruel World!"));} had the same length and was more interesting. It seems that f(i){i=puts("Goodbye Cruel World!")/0;} would have worked too.

It should be mentioned that the program is required to crash by no mean...

You don't need i. puts("")/0; is a syntactically correct statement.

@rici Yes it is, but it doesn't crash (at least on TIO).

@Steadybox: that's optimization for you.

Jelly, 12 bytes
“¿µƝɓṭỵae»Ȯ:

Try it online!
Explanation:
“¿µƝɓṭỵae»Ȯ:

          Ȯ     Print
“¿µƝɓṭỵae       A string...
         »      Decoded from base-250
           :    Integer division

As the integer division is a dyad, it will implicitly take the chain's current value as both arguments - which is a string. Crashes because it expects integers.

Welcome to PPCG!

Thank you! I've been lurking for a while now but this is the first time I found a challenge that I felt like I could actually solve decently!

Impressive answer, although nearly all Jelly answers are impressive, both because of the length and the fact that you managed to learn Jelly.

A base-250 encoded string That is both cool an scary that you can do that. X3

This is significantly shorter than the string "Goodbye cruel world!" (20 bytes). Crazy...

R, 22 20! bytes (44/2) (40/2)
cat("Hello World!")
`Goodbye Cruel World!`

Try it online!
Output:

Hello World!
Error: object 'Goodbye Cruel World!' not found

Saved two points thanks to digEmAll

You can shorten it to 40/2  Try it online!

sed, 32 bytes
iGoodbye Cruel World!
w/dev/full

i inserts a line, and w writes to a file. /dev/full in this case because all writes to it return ENOSPC ("No space left on device").
It still needs a single line of input to work, though.
$ echo 1 | sed -f crash.sed
Goodbye, cruel world!
sed: couldn't flush /dev/full: No space left on device

Didn't even know there exists such a device!

Python 3 | Score: 24.5! 23 22!
print("Hello World!")+"Goodbye Cruel World!"

Print "Hello World", than use invalid operator '+' on "Goodbye Cruel World!" to the NoneType return element. (cut out \n\r from previous version)
Try it online!
Python 3 | Score: 34 30
+print("Goodbye Cruel World!")

Print Goodbye, than do an invalid unary + operation on print result (NoneType)
Try it online!

+"Goodbye Cruel World!" is shorter by 3 bytes and outputs a TypeError.

print("Goodbye Cruel World!")/0 is shorter for the second one (3 bytes?)

@matsjoyce I was afraid that would crash before the print. But since it prints first, I'll just do unary on the print 'result' :3

2.585e+22 is a pretty big score... you sure you couldn't golf it down more?

@tuskiomi The '!' means that the final score is modified by the bonus challenge.

For the first one, the newline isn't necessary since you can perform addition on the None result from the print and the string, resulting in a crash (unless the error message can't contain "Hello World!" as well).

SOGL, 15 25 17 bytes / 2 = 8.5!
Q7┌θ/²?‘■←#c℮‘o0n

Explanation:
...‘           push "goodbye cruel world!"
    ...‘       push "hello world!"
         o     output "Hello World!"
           0n  attempt to make an array where each line is 0 characters long, making the array
               required to be infinite, which crashes (OutOfMemoryError)

(Ab)uses the fact that SOGL uses STDERR as a debug output, so in it there is a lot of text, along with the line
`∑`@22: ["goodbye cruel world!"]

If you piped the STDOUT of the Processing sketch to a file, the "Goodbye Cruel World!" would be there.

Since the challenge mentions "The strings Hello World! and Goodbye Cruel World! are case insensitive, but otherwise should appear exactly as above.", you can golf your code by getting rid of the function █ entirely and just output in all lowercase.

@KevinCruijssen oh huh, thanks!

><>, 25 bytes
"!dlroW leurC eybdooG">o<

Basically it adds the string to the stack (Backwards, last in first out) and then does the equivalent of:
while(1):
  pop the stack
  print the character

When there are no characters left on the stack (The whole string has been printed) popping the stack gives an error

+1. Came to #o<"Goodbye Cruel World!", which is basically the same.

Lua, 31, 30 bytes
a=-print'Goodbye Cruel World!'

first prints out 'Goodbye Cruel World!' and then crashes when trying to add a nil value and 0.
Output:
Goodbye Cruel World!
input:1: attempt to perform arithmetic on a nil value

Credit to GalladeGuy for 1 byte less

it prints out 'Goodbye Cruel World!' and then crashes though which i just thought it would simply have to crash to be accepted.

@Trebuchette The requirement is "Your program must print Goodbye Cruel World! to output, and then crash", the OP did not specify whether or not "output" means stderr, stdout, a messagebox, or any of the above.

@Pharap Oh, I see. STDERR only matters if you're going for the bonus. Thanks!

@Trebuchette Nope. It says "Or, as a bonus twist challenge, print Hello World! and crash with Goodbye Cruel World!". 'crash' does not necissarily imply stderr, 'crash' can also mean (among other things) an exception being thrown. Unless the OP defines it further it's open to interpretation. Also some applications of Lua have no concept of stderr (e.g. Lua embedded as a scripting language for games) and will instead print to a message box or a log file etc.

You can save a byte by doing this instead: a=-print"Goodbye Cruel World!"

Ah yes, very true. Nice catch! :)

C Preprocessor, 27 bytes
#error Goodbye Cruel World!

Output:
fatal error C1189: #error:  Goodbye Cruel World!

You may be able to shorten it further with just #Goodbye Cruel World!

@apricotboy That would still produce an error but the full error message "goodbye cruel world" isn't output by the compiler (on MSVC at least)

@Gorvind Parmar ah. Well it definitely does on gcc: http://i.imgur.com/qmGnoJv.png

Operation Flashpoint scripting language, 45/2 = 22.5 bytes
f={hint"Hello World!";a Goodbye Cruel World!}

Call with:
call f;

Output:

AWK, 72 bytes, Score 36!
BEGIN{print"Hello World!";print"Goodbye Cruel World!">"/dev/stderr";0/0}

Try it online!
AWK isn't fond of trying to divide by 0.

C#, 116 / 2 = 58 bytes!
using System;class P{static void Main(){Console.Write("Hello World!");throw new Exception("Goodbye Cruel World!");}}

Normal version for 94 87 bytes:
class P{static void Main(){System.Console.Write("Goodbye Cruel World!");int n=0;n/=n;}}

Saved 7 bytes thanks to @KevinCruijssen.

int n=0;n/=n; is shorter for your first answer.

@KevinCruijssen Nice spot, I was having trouble with getting it to compile without division by constant zero error.

Yeah, in Java you can just do int n=1/0;, but apparently that isn't possible in C# (which is actually a good thing for the language, but bad for codegolfing). Btw, why isn't the bonus on at the top? That one is shorter.

@KevinCruijssen I wasn't sure if it qualified as it was a bit unclear when I posted my answer, seeing as it has been further clarified I've switched them around.

CJam, 34 bytes, score 17!
"Goodbye Cruel World!"D>"Hello"ooo

Try it online! (See Debug panel for STDERR)
Explanation
"Goodbye Cruel World!"              e# Push "Goodbye Cruel World!".
                      D>            e# Slice after index 13: " World!".
                        "Hello"o    e# Push "Hello" and print it.
                                o   e# Print " World!".
                                 o  e# Attempt to print from an empty stack. Crashes.

On TIO, it generates this error message:
"Goodbye Cruel World!"D>"Hello"ooo
                                 ^
RuntimeException: The stack is empty
Java exception:
java.lang.RuntimeException: The stack is empty
    at net.aditsu.cjam.CJam.pop(CJam.java:75)
    at net.aditsu.cjam.Op1.run(Op1.java:10)
    at net.aditsu.cjam.Block.run(Block.java:304)
    at net.aditsu.cjam.CJam.runCode(CJam.java:210)
    at net.aditsu.cjam.CJam.main(CJam.java:240)

APL (Dyalog), 17.5 bytes
Without bonus, 20 bytes
Goodbye Cruel World!

Try it online!
Note that the code is unquoted, so APL tries to execute it but World is not defined, causing a VALUE ERROR crash with the offending line of code included in the error message.
With bonus, 35 ÷ 2 = 17.5 bytes
'Hello World!'
Goodbye Cruel World!

Try it online!
First prints the required string, then crashes like the above program.
More sofisticated bonus version, 35 ÷ 2 = 17.5 bytes
⍎'Goodbye Cruel',5↓⎕←'Hello World!'

Try it online!
Prints the first string, then drops the first five characters from that (5↓), then concatenates that (,) to a new prefix, and then attempts to execute (⍎) that, causing the same error as above.

Node.js, Score: 25.5 24.5!
Saved 1 point thanks to ETHproductions
A syntactically correct full program which crashes at runtime because console.log() is not returning a function.
console.log('Hello World!')`Goodbye Cruel World!`

Try it online!

Sadly, there is no factorial for 25.5...  :((

@Mr.Xcoder It is Gamma(26.5), as with Mathematica definition.

@user202729 who said Mathematica ain't broken? :)))

Can you remove the X (and maybe even the newline)?

@ETHproductions Yes indeed. Thanks!

will it crash??

@SagarV Yes. It prints Hello Worlds!, throws TypeError: console.log(...) is not a function (you need to expand the debug section of TIO to reveal the error) and halts. Any code that would be added after that would never be executed.

the error message must also contain Goodbye Cruel World! I don't think TypeError: console.log(...) is not a function satisfy

The debug sections does contain that phrase though ;)

@l4m2 I realize that there's indeed some ambiguity in the challenge about what the error message exactly is. But I believe it is correct according to the 6th rule.

oo when I run it on explorer console it doesn't print the source code in err

@l4m2 I've updated the language to Node.js, which is consistently showing the expected behavior.

PowerShell, 26 Bytes
'Goodbye Cruel World!';1/0

I think dividing by 0 is the easiest way to throw an error.
PowerShell, 35/2 = 17.5 Bytes
"Hello World!";Goodbye Cruel World!

by TessellatingHeckler, throws the error like so:
PS C:\Users\Connor> "Hello World!";Goodbye Cruel World!
Hello World!
Goodbye : The term 'Goodbye' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:16
+ "Hello World!";Goodbye Cruel World!

Shouldn't it be $w='World!' (with an !)?

"Hello World!";Goodbye Cruel World! is 17.5 bytes, throws an exception because Goodbye is not recognized as a command, and the exception message includes the line in full so it matches the regex..

Using the same logic as the 17.5b answer, 'Goodbye Cruel World!';x would save two bytes for 24

WinDBG (Windows XP/Vista Local Kernel Debugging), 33 bytes
.echo Goodbye Cruel World!;.crash

Warning: This will crash the entire machine, not just the program.
Local kernel debugging is only allowed on Windows XP and Vista (but not enabled by default in Vista). The WinDBG dialog on local kernel debugging does't mention any other Windows OS so I assume it can't even be enabled for those. Presumably for other Windows OS's you can attach to a remote machine for kernel debugging, but it's the remote machine that will crash so I don't think this solution counts there.

Local kernel debugging is also supported on Windows 7, and I haven't heard that it's been removed since then (but I may have missed it).

TeX, 19!
Hello World!#\bye Goodbye Cruel World!

To force TeX to actually produce a dvi/pdf file without manual intervention, compile with -interaction=nonstopmode.
It prints Hello World!, throws an error for using # when you're not supposed to and then stops compilation with \bye. However, whatever's after \bye is still output in the error message, so it applies for the bonus.

Bash 20.5! 18.5!
I am not going to bash jelly, but I am a little bashful of my bash at bashing out a quick bash script. 18.5 isn't too bad for a non-golfing language. (Note this has to be a script, interactive bash will try to interpret ! as a history lookup)
echo Hello World!
Goodbye\ Cruel\ $_

Returns with error code 127 and:
Hello World!
bash.sh: line 2: Goodbye Cruel World!: command not found

As requested no "'s... anywhere :). As suggested by apricot boy I now lookup the last argument of the previous command to save 4 bytes.

I tried to beat you … and failed with 21! bytes. :)
W=\ World\!;echo Hello$W;"Goodbye Cruel$W"

You could probably change the second line to Goodbye\ Cruel\ !$, not 100% but pretty sure that !$ is "last word of last command"

But what if an executable named "Goodbye Cruel World!" exists in the PATH? :)

Verified OK on TIO.run... beats my zsh answer :/

JS (ES5), 46 / 2 = 23 bytes!
alert("Hello, World!")["Goodbye Cruel World!"]

Alerts Hello, World!, then errors with Uncaught TypeError: Cannot read property 'Goodbye Cruel World!' of undefined

Fortran (GFortran), 58/2=29 bytes!
PRINT*,'Hello World!'
ERRORSTOP 'Goodbye Cruel World!'
END

Try it online!

Japt, 22 bytes
°Oo`!dlžW ¤¨C eybºoG`w

°Oo`!dlžW ¤¨C eybºoG`w
 Oo                            output
   `!dlžW ¤¨C eybºoG`     the compressed string "!dlroW leurC eybdooG"
                          w    reversed.
°                              ° transpiles to ++, causing an error; a string can't be incremented

Try it online!
Saved 3 bytes thanks to obarakon and ETHproductions

You can compress the string using Oc"<string>" and then replace the current string with the compressed version and surrounded by backticks.

An explanation would be nice.

@iFreilicht explanation added.

Aceto, score: 21.5!
yeru
b Ce+
do l"d
GoWorl
"!dl
p"or
HeW
"llo

Prints Hello World!, then crashes with
Traceback (most recent call last):
  File "/Users/l3viathan/bin/aceto", line 230, in _plus
    self.push(y+x)
TypeError: unsupported operand type(s) for +: 'int' and 'str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/l3viathan/bin/aceto", line 811, in <module>
    A.run()
  File "/Users/l3viathan/bin/aceto", line 104, in run
    raise e
  File "/Users/l3viathan/bin/aceto", line 98, in run
    self.step()
  File "/Users/l3viathan/bin/aceto", line 152, in step
    method(self, cmd)
  File "/Users/l3viathan/bin/aceto", line 233, in _plus
    raise CodeException(f"Can't add {x!r} to {y!r}")
__main__.CodeException: Can't add 'Goodbye Cruel World' to 0

Pyth, 28 24 bytes
"GOODBYE CRUEL WORLD!"hY

Prints a string, then tries to get the first element of the empty list.
Try this!

Jelly, 10.5! bytes
“,ḷṅḳȦ»¹“¿µƝɓṭỵae»+/R

Try it online!
This exploits undefined behavior, using Python strings (strings) instead of Jelly strings (list of 1-char strings). The conversion is done by reducing the Jelly string by addition, and Python's + concatenates two strings, so two strings added together are concatenated Python-wise. Then, it uses the appropriate monad (range) so that Python's int is called on the string, resulting in an error that would always contain Goodbye Cruel World!.
Explanation:
“,ḷṅḳȦ»¹“¿µƝɓṭỵae»+/R Main Link, niladic.
“,ḷṅḳȦ»¹              Print "Hello World!"
        “¿µƝɓṭỵae»+/  Convert "Goodbye Cruel World!" to a Python string
                    R Make a range out of it

x86-64 Binary Code (with Linux system calls), 43 bytes
Disassembly:
0:  31 c0                   xor    eax,eax
2:  ff c0                   inc    eax            ; write syscall number = 1
4:  31 ff                   xor    edi,edi
6:  ff c7                   inc    edi            ; stdout file descriptor = 1
8:  48 8d 35 07 00 00 00    lea    rsi,[rip+0x7]  ; load the string at offset 16 into rsi
f:  31 d2                   xor    edx,edx
11: b2 15                   mov    dl,0x15        ; 21 byte string
13: 0f 05                   syscall
15: f4                      hlt
16: 47 6f 6f 64 62 79 65 20 43 72 75 65 6c 20 57 6f 72 6c 64 21 0a .ascii "Goodbye Cruel World!\n"

Note: 0x16 code bytes + 0x15 string bytes = 0x2B = 43 total bytes

This program bundles the data it needs (the string "Goodbye Cruel World!\n") into its own code. It loads a pointer to that string using rip relative addressing, and calls the write syscall directly rather than through a glibc wrapper, so it's entirely position-independent, and we can easily test it by embedding the code into a const string and casting that string to a function pointer. To crash the program, I end it with a hlt instruction, which with ring 0 privileges would silence the processor forever (or at least until the next interrupt comes in), but with ring 3 privileges (typical for user programs) we get a far less dramatic Segmentation Fault.
Test Program:
#include <stdio.h>

const char code[43] = "\x31\xC0\xFF\xC0\x31\xFF\xFF\xC7\x48\x8D\x35\x07\x00\x00\x00\x31\xD2\xB2\x15\x0F\x05\xF4Goodbye Cruel World!\n";

int main() {
    printf("Code bytes: %zi\nNow running the code:\n\n", sizeof(code));
    ((void(*)())code)();
    printf("Failed to crash, now exiting!\n");
    return 0;
}

Output:
Code bytes: 43
Now running the code:

Goodbye Cruel World!
Segmentation fault

Note that the 43 byte code is a complete program as specified by the challenge, not just a function. It doesn't depend on the main function of the test program to function correctly; it would still print the string and crash if loaded and jumped-to by the loader directly.

Save a few bytes by using push/pop to load registers. For example, the first two instructions can be push 1+pop rax, which is 1 byte shorter. Then, the next two instructions can be replaced with mov edi, eax, which is 2 bytes shorter. The same push/pop trick can be applied to instructions 6 and 7: push 0x15+pop rdx.

LOLCODE, I CAN HAZ 21 BYTES
:Goodbye Cruel World!

Simply places an invalid operator in front of the string. You can give it a go online here.

x86 and x64_64 machine language on Linux, 38 61 bytes/2=30.5! 60 bytes/2=30!
00:       e8 20 00 00 00          call  0x25
05:       48 65 6c 6c 6f 20 57    "Hello World!Goodbye Cruel World!"
          6f 72 6c 64 21 47 6f
          6f 64 62 79 65 20 43
          72 75 65 6c 20 57 6f
          72 6c 64 21
25:       59                      pop   %ecx
26:       6a 01                   push  $0x1
28:       5b                      pop   %ebx
29:       6a 0c                   push  $0xc
2b:       5a                      pop   %edx
2c:       6a 04                   push  $0x4
2e:       58                      pop   %eax
2f:       cd 80                   int   $0x80
31:       01 c0                   add   %eax,%ecx
33:       b3 02                   mov   $0x2,%bl
35:       b2 14                   mov   $0x14,%dl
37:       2c 08                   sub   $0x8,%al
39:       cd 80                   int   $0x80
3b:       6e                      outsb  %ds:(%esi),(%dx)

Prints Hello World! to stdout and Goodbye Cruel World! to stderr. Crashing is easy in machine language. To
Try it online!, compile and run the following C program.
const char main[]="\xe8 \0\0\0Hello World!Goodbye Cruel World!Yj\1[j\fZj\4X\xcd\x80\1\xc1\xb3\2\xb2\24,\b\xcd\x80n";

EDIT: TIO link now works again.

Since a 64 bit number can represent 8 chars, I wonder if it is possible to construct the string using some clever arithmetic and shifting. Specifically 47 6f 6f 64 62 79 65 20 43 72 75 65 6c 20 57 6f 72 6c 64 21.

64 bit multiply fills up rdx:rax

OCaml, 28.5! (57 Bytes / 2)
The OCaml version:
print_string"Hello World!";failwith"Goodbye Cruel World!"

The output is:
Hello World!Fatal error: exception Failure("Goodbye Cruel World!")

Welcome to the site! :)

Rust, 66 bytes / 2 = 33
fn main(){println!("Hello World!");panic!("Goodbye Cruel World!")}

Try it online!
Prints "Hello World!" and makes the the program panic with message "Goodbye Cruel World!"
The panic! macro doesnt need a semicolon because it returns () just like the main function.

Hi and welcome to PPCG! Just a small correction: the panic! macro returns the never type (!), which can be used as any type (including ()) example playground

todo! is shorter than panic! (although not supported in TIO) and print! is shorter than println!. You can save 3 bytes for a score of 31.5 :)

x86-16 machine code, PC DOS, 28 bytes
00000000: b409 ba07 01cd 2147 6f6f 6462 7965 2043  ......!Goodbye C
00000010: 7275 656c 2057 6f72 6c64 2124            ruel World!$

Unassembled listing:
B4 09       MOV  AH, 9              ; DOS display string function
BA 0107     MOV  DX, OFFSET BYE     ; load address of message
CD 21       INT  21H                ; print and say goodbye
       BYE  DB  'Goodbye Cruel World!$'

Explanation
This will first display the string below without terminating the program.  It will then continue to execute the subsequent memory contents as random CPU instructions, including jumps to other code, hardware, etc.
This will likely crash DOS to the point that a hard reset (power cycle) of your PC will be required.

Octave, 28 bytes
disp"Goodbye Cruel World!"
d

Try it online!
This displays "Goodbye Cruel World!" in the shortest possible way in Octave (by skipping the parentheses and avoiding a space).
The d on the next line is an undefinied variable, so it errors with the message:
error: 'd' undefined near line 2 column 1
error: called from
    .code.tio at line 2 column 1

If it's OK to output: ans = Goodbye Cruel World! then it can be 24 bytes.

PHP, 26
Goodbye Cruel World!<?=!a;

This doesn't crash. In fact, this only throws a warning which usually are disregarded. Basically, your code is just Goodbye Cruel World! which is incorrect. If you want to crash, do <?x();, which will throw an exception in PHP 7+.

Haskell, 54 53 bytes, score 27! 26.5!
main=putStr"Hello World!">>fail"Goodbye Cruel World!"

Try it online! Outputs Hello World! and produces the following error message:
.code.tio: user error (Goodbye Cruel World!)

Edit: -1 byte/-0.5 score thanks to @nimi for suggesting fail.

fail instead of error.

@nimi Thanks! I didn't know about fail before.

Arcplus, 25 bytes
(p "Goodbye Cruel World!"

The stderr output doesn't contain Goodbye Cruel World as required for the bonus multiplier.

@L3viathan the spec doesn't specify STDERR: but the debug must also contain

@L3viathan it doesn't output the exact string though, due to the spaces vs underscores, so I'll change it anyway

Yeah, that's what I meant, I didn't complain that it wasn't stderr.

Ruby, 43 42 bytes/2 = 21!
puts"Hello World!"
-"Goodbye cruel World!"

Saved half a byte with the help of Alexis Andersen, by replacing "String"/0 with -"String". This only "works" with Ruby versions lower than 2.3, in which the unary minus method was actually added to the String class!
With Ruby < 2.3:
$ ruby -e 'puts"Hello World!";-"Goodbye cruel World!"'
Hello World!
-e:1:in `<main>': undefined method `-@' for "Goodbye cruel World!":String (NoMethodError)

With Ruby >= 2.3:
$ ruby -e 'puts"Hello World!";"Goodbye cruel World!"/0'
hello world!
-e:1:in `<main>': undefined method `/' for "Goodbye cruel World!":String (NoMethodError)

you can save (half) a byte by using - on the string instead of / i.e. -"Goodbye crueld World!"

@AlexisAndersen thanks! Today I also learned about a new method in the String class (see updated post)

Swift - 50 bytes, 25 points after bonus
print("Hello World!\nGoodbye Cruel World!")
[0][1]

Can you do something like print("Goodbye Cruel World");1/0, instead of using fatalError?

@Riker my understanding was that the good bye had to come after the error

@Riker cool, I'll fix it when i get on my computer, thanks

@Riker Division by a zero literal is a compile time error

Let us continue this discussion in chat.

Go, 76 bytes, score 38!
package main
func main(){print("Hello World!");panic("Goodbye Cruel World!")}

(Edit: switch strings around).
Formatted:
package main

func main() {
        print("Hello World!")
        panic("Goodbye Cruel World!")
}

No semicolon in formatted version because of the line breaks.
https://play.golang.org/p/DM48LwZ_0T
Might be able to reduce this with a wizardry int-->string hack, but whatever.

Switch the strings around. "Hello World" should be in STDOUT, and "Goodbye Cruel World!" should be in the error message. (for the bonus challange)

Go's print() prints to STDERR, not STDOUT. You have to use fmt for printing to STDOUT.

@totallyhuman Is that not a compile/runtime configuration? The Go spec only defines it as "prints all arguments; formatting of arguments is implementation-specific" so the Go code itself is correct, no?

TI-BASIC, 24 bytes (which happens to be 4!)
:Disp "GOODBYE CRUEL WORLD!
:{

Displays the string, then partially defines a list, causing a syntax error.

If you replaced the "{" with a "(", you could have a frowny emoticon as the last line. Would that have the same effect?

@eaglgenes101 No. ( does not define a list, it just groups expressions.

Julia, 30 bytes
!print("Goodbye Cruel World!")

Eagerly prints "Goodbye Cruel World!", then tries to NOT the return value and crashes because performing a NOT on a void value is not defined.

Pyth, 38 / 2 = 19 bytes! 36 / 2 = 18 bytes!
"Hello World!"v"Goodbye Cruel World!

Test it online!
Explanations
It prints Hello World!, then try to evaluate Goodbye Cruel World!. It fails doing it, because that string is not a valid code.
The result is:
Hello World!
Traceback (most recent call last):
  File "pyth.py", line 760, in <module>
  File "<string>", line 4, in <module>
  File "/app/macros.py", line 1085, in Pliteral_eval
  File "/app/.heroku/python/lib/python3.4/ast.py", line 46, in literal_eval
  File "/app/.heroku/python/lib/python3.4/ast.py", line 35, in parse
  File "<unknown>", line 1
    Goodbye Cruel World!
                ^
SyntaxError: invalid syntax

SmileBASIC 3, 28 bytes
Tries to call a function named the empty string, which of course doesn't exist.
There's probably a better way to make a SB program crash, but this way is only 5 characters, so I'm not complaining.
?"Goodbye Cruel World!
CALL"

Using a weird bug: ?"Goodbye Cruel World!";?

Kotlin, 89/2= 44.5 bytes!
Pretty much the same as the java answer
fun main(args:Array<String>){
println("Hello world")
throw Error("Goodbye cruel world!")}

Try it online!
Output:
Hello world

Exception in thread "main" java.lang.Error: Goodbye cruel world!
    at Simplest_versionKt.main(Simplest version.kt:8)

Alice, 44 40 bytes, score 22 20!
"!dlroW olleH"d&o`Goodbye Cruel World!é

Try it online!
-4 bytes by finding an interpreter bug.
Explanation
"!dlroW olleH"       push this string (one character at a time)
              d      stack depth
               &o    output that many bytes
                 `   print debug information

The Alice interpreter is written in Ruby, which can be strict about character encoding.  When the debug command attempts to output the é (or any character in the range 0x80-0xFF) at the end of the program, this character is interpreted as ASCII-8BIT instead of UTF8, causing a crash.
Mode: Cardinal
Grid:
                 v
"!dlroW olleH"d&o`Goodbye Cruel World!Mode: Cardinal
Grid:
                 v
"!dlroW olleH"d&o`Goodbye Cruel World!/opt/alice/state.rb:234:in `write': "\xE9" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
    from /opt/alice/state.rb:234:in `<<'
    from /opt/alice/state.rb:234:in `block (2 levels) in print_grid'
    from /opt/alice/state.rb:234:in `each'
    from /opt/alice/state.rb:234:in `block in print_grid'
    from /opt/alice/state.rb:233:in `each'
    from /opt/alice/state.rb:233:in `each_with_index'
    from /opt/alice/state.rb:233:in `print_grid'
    from /opt/alice/state.rb:221:in `print_debug_info'
    from /opt/alice/interpreter.rb:16:in `rescue in '
    from /opt/alice/interpreter.rb:13:in `'

Crossed out 44 is still a regular 44. ;(

PHP, 24 bytes
<?d'Goodbye Cruel World!

Produces:
Parse error: syntax error, unexpected ''Goodbye Cruel World!' (T_ENCAPSED_AND_WHITESPACE) in [...][...] on line 1

JavaScript (ES6), 43 / 2 = 21.5 bytes!
alert`Hello World!`['Goodbye Cruel World!']

The same method as OrphanBot, but saves a few bytes with ES6 template strings.

Hello and welcome to the site.  It is customary to put separate languages in separate answers.  The site may prompt you not to but thats SE's policy not ours.

F#, score: 32!
[<EntryPoint>]printf"Hello World"
failwith"Goodbye Cruel World!"

Try it online!

SmileBASIC, 44/2 = 22 bytes!
At first I thought there would be no way to get the bonus, since errors in SB only show a specific message along with the line number (ex: IF without THEN in 0:4) But then I remembered that MML (the language used for playing music) gives more detailed error messages, which display the code that caused the error!
?"Hello, World!
BGMPLAY"Goodbye Cruel World!

Output:
Hello, World!
Illegal MML in 0:2(BGMPLAY:1)
  Goodbye Cruel World!
    ^
 Missing number (in Track 0)

The error occurs because the o (set octave) command expects a number.

Kotlin, 88 bytes/2=44 bytes!
fun main(a:Array<String>){print("Hello World!")
throw Exception("Goodbye Cruel World!")}

Try it online!

Using @EndermanAPM Error instead of Exception would yield 84/2 or 42.

Assembly (MIPS, SPIM), 97 92 bytes
.data
a: .asciiz "Goodbye Cruel World!"
.text
.globl main
main:
li $2 4
la $4 a
syscall
j $0

Try it online!
Not gonna lie, i haven't touched MIPS in a long time. Plus i'm not familiar with what shortcuts i can use with SPIM, but  i'm satisfied.
For those of you not familiar with mips, the dumbed down version: data declares allocated data (obviously) which in our case is the ascii string. Text is our function space, and main is our main method.  Interestingly, mips lacks a native output, so we need a system call for this.
li $2 4 means load immediate, or put a number in this register. In this case 4, to the $V0 register. This will tell the system call what it's doing, and 4 roughly means "print text"
la $4 a Next, we load the address of our text into a register so that the system call knows what it's printing.
Then we call syscall our system call.
To break it, i jump to 0 which is essentially a goto. 0 is not a valid target, so it errors. This saves 5 bytes over divide by zero.
Edit: Safe Alternative  112 Bytes.
Try it online!
If you're not fond of a program running until it essentially overflows the stack, this will create an exception and exit safely thereafter. This one does so by trying to read from a misaligned location, which is a few bytes shorter than divide by zero.

Quick note: jump to 0, aside from causing errors, is an incredibly unexpected behavior - what it does is fail spectacularly. Afaik most emulators for mips will just error and call it a day, though i can't vouch for all of them. If this behavior is too much of a "watch the world burn" i can tone it down to whatever is desired, i guess

extra credit for crashing the system, not just a program :)

Wren, 37 bytes
-System.print("Goodbye Cruel World!")

Try it online!
Explanation
              "Goodbye Cruel World!"  // Define the string "Goodbye Cruel World!"
 System.print(                      ) // Output the string to STDOUT
-                                     // Apply negation upon the returned string
                                      // which is "Hello World". Negation on strings
                              // isn't defined in Wren.

Definitely thank you for the explanation.

F#, 71 bytes
[<EntryPoint>]
let main a=
  printfn"Goodbye Cruel World!"
  a.[0]|>int

Try it online!
The function main takes an array of strings a and has a return value of integer. The program attempts to get index 0 of the arguments, even though there are no arguments. The |>int converts a.[0] to an int, or otherwise, the program wouldn't compile because the return value has to be int. The boilerplate code [<EntryPoint>] kind of made it necessarily long but you, unfortunately, cannot get rid of it.

Welcome to CGCC! Here is a Try it online! link for your submission which makes it easier for others to test your solution.

I don't now much about F#, but at least the Hello-World Example on TIO runs fine without the [<EntryPoint>] boilerplate, so it might be worth checking out when exactly it is needed. Try it online!

I just found there is an implicit entry point. Then the whole main is not needed and just printfn"Goodbye Cruel World!";[].[0] would work with the same error: Try it online!

@Laikoni thank you very much!

BRASCA, 33 29 28 27 bytes
-4 bytes
-2 bytes thanks to Command Master
`!dlroW leurC eybdooG`[o]~o

Try it online!
Explanation
`!dlroW leurC eybdooG`              - Push "Goodbye Cruel World!", reversed
                      [o]           - Output the stack
                         ~o        - Attempt to print a character with codepoint -1, which crashes.

Wouldn't \!dlroW leurC eybdooG`[o]1-o` work and be shorter?

You can also use ~ instead of 1-

Perl 5, 43/2 = 21.5 bytes!
say'Hello World!';die'Goodbye Cruel World!'

Pretty straightforward. die just crashes the program with the given error message plus some extra fluff.

Can't remember the exact rule but this program doesn't run without the -E flag, so you need to add at least one byte.

@pipe The -E flag is allowed on this site without a penalty, since it's arguably the "normal" way of writing a perl one-liner.

Micro, 24 20.5
"Hello, World!":\"Goodbye, cruel world"0/

Previous version, no bonus:
""Goodbye, cruel world"0/

Lua, 47 / 2 == 23 bytes
Prints "Hello World!" to STDOUT, then crashes with "Goodbye cruel world!" and a stack trace to SDTERR.
print"Hello World!"
error"Goodbye cruel world!"

Pyth -- 38/2 = 19 !
K" World!"p"Hello"Kp"Goodbye Cruel"KsG

Try It

Java 6, 83 bytes, Score 41.5!
Java 6 loaded static initializers before searching for the main method, making it possible to bypass the lengthy main signature. However, past 6, it first looks for the main method and then static initializers, making this solution void.
class A{static{System.out.print("Hello World!");new Long("Goodbye Cruel World!");}}

Expanded:
class A {
    static {
        System.out.print("Hello World!");
        new Long("Goodbye Cruel World!");
    }
}

C, 60 bytes
puts("Hello, World!");puts("Goodbye, cruel world!");abort();

Ruby, 38 bytes, score 19!
p"Hello World";"Goodbye cruel World".q

Run with ruby -e

The output should contain the specified string, and nothing else. -- This prints extra quotes around the string.

APL, 28
÷~×⍴⎕←'Goodbye Cruel World!'
This first displays the text, then tries to take the reciprocal ÷ of the not ~ of the sign × (an integer 1) of the length ⍴ of the text.  As the sign of the length will always be 1, the not of which is 0, the reciprocal will produce a DOMAIN ERROR.
In all fairness, ngn\apl does not crash, rather will output infinity.  Nearly all other (legacy) APLs such as Dyalog, APL2000, and IBM APL2, do not handle NaNs or +/-Inf and will crash as expected.

You can just remove ~×⍴ since the reciprocal of a string gives a DOMAIN ERROR on all APL systems.

JavaScript 58 bytes , with bonus 58/2 = 29 bytes
console.log("Hello World!");
throw "Goodbye Cruel World!"

Very Straightforward , I have crashed the program with the "Good Bye Cruel World!" error.
EDIT : Thanks to eithed and Erik the OutGolfer , Saved 36 bytes !. Hope this method still works for the challenge

You don't need to assign the message - console.log("Hello World!");throw new Error("Goodbye Cruel World!") will suffice (or even console.log("Hello World!");throw "Goodbye Cruel World!", though the rules are kind of weird for JS on this one)

You can remove superfluous whitespace around the =s and newlines after ;s.

Kitanai (28 bytes)
print"Goodbye Cruel World!"z
It just prints "Goodbye Cruel World!" then tries to call unknown function z (so it crashes)

Java 8, 108 bytes, score 54!
interface M{static void main(String[]a){System.out.print("Hello World!");new Byte("Goodbye Cruel World!");}}

Try it online here.
This solution attempts to create a Byte from the given String and crashes since "Goodbye Cruel World!" cannot be evaluated to an integer value.
Java 8, 93 bytes (no bonus)
interface M{static void main(String[]a){System.out.print("Goodbye Cruel World!");int i=0/0;}}

This is pretty straightforward as well. It crashes upon trying to divide by zero.
Try it online here.

J, 28 Bytes
=:echo'Goodbye cruel world!'

Echoes 'Goodbye cruel world!', and then encounters a syntax error when theres no variable to assign the result (an empty list) to.
Example:
   =:echo'Goodbye cruel world!'
Goodbye cruel world!
|syntax error
|   =:echo'Goodbye cruel world!'

Processing 3, 42 bytes
println("Goodbye Cruel World!");int b=1/0;

First try at using Processing for a golfing challenge. Couldn't figure out a way for the bonus challenge since Processing is very good at finding errors before you run your code!

Clean, 64 bytes / 2 = 32 score
-2 thanks to Jo King
import StdEnv
Start=("Hello world!",abort"Goodbye cruel world!")

Try it online!
Prints Hello world!, tries to print the second element of the tuple and aborts with Goodbye cruel world!

05AB1E (legacy), score: 13.5 13 11.5 (23 bytes / 2 for bonus)
…Ÿ™‚ï!“‚¿bye±ƒuel‚ï!“.ǝ

Try it online.
-1.5 (-3 bytes) thanks to @Grimy.
Outputs in full lowercase.
05AB1E (legacy) is unable to exit with an error as far as I know (unless there is a bug in its source code), so instead this will print hello world! to STDOUT and goodbye cruel world! to STDERR.
Explanation:
…                 # Three lowercase dictionary-compressed words with space delimiter
 Ÿ™               #  "hello"
   ‚ï             #  "world"
     !            #  Literal "!"
“             “   # Push dictionary string in lowercase with automatic space-delimiter:
 ‚¿bye±ƒuel‚ï!    #  "goodbye cruel world!"
               .ǝ # Print to STDERR
                  # And print the top of the stack to STDOUT implicitly

See this 05AB1E this of mine (section How to use the dictionary?) to understand why …Ÿ™‚ï! is hello world! and “‚¿bye±ƒuel‚ï!“ is goodbye cruel world!.

05AB1E, score: 11.5 (23 bytes / 2 for bonus)
…Ÿ™‚ï!,“‚¿bye±ƒuel‚ï!“F

Unlike the legacy version, the new version is able to error out sometimes. The difference between the above program are:

The ,, which is an explicit print with trailing newline
And F instead of .ǝ, which is a ranged loop and will error because the "goodbye cruel world!" is not an integer:

(RuntimeError) Could not convert goodbye cruel world! to integer.

} exits in an error (non-legacy). Try it online! Also, for legacy .0 causes division by 0 error forcibly.

@MagicOctopusUrn Ah, completely forgot about .0, since the commands had already changed when I posted this and it's not in the new version anymore. As for the errors in the Elixir rewrite, it can crash with quite a few different ways now, but mostly due to a bug that wasn't in the legacy version yet, so usually I report it in the 05AB1E chat to Adnan.

.•Uqʒ•’‚¿Þ¡ ÿ ‚ï!’ -> “‚¿bye±ƒuel‚ï“ for -4. There's no .ǝ in modern 05AB1E, but here's an equal-bytes alternative.

@Grimy Thanks. Didn't knew cr was a dictionary word.

22/2 is 11, not 11.5.

@Grimy Woops, should have been 23 instead of 22.. Your versions were missing the exclamation mark in the goodbye cruel world!. I've updated the 11 to 11.5 when I noticed that, but forgot to update the 22.

PowerShell, 49 bytes
'Goodbye Cruel World!';[Environment]::FailFast(0)

Try it online!
Prints Goodbye Cruel World! and crashes. Uses the .NET built-in FailFast() feature.

Invalid, "Goodbye Cruel World!" must be in the error

@ASCII-only Fixed.

JavaScript, 55 bytes, score 27.5!

console.log('Hello World!')
throw'Goodbye Cruel World!'

JavaScript, 51 bytes, Real Crash
[console.log("Goodbye Cruel World!"),...Array(1e9)]

Keg, 23 bytes
Basically a port of the ><> answer.
\!dlroW leurC eybdooG{,

Explanation
\!dlroW leurC eybdooG#Push "Goodbye Cruel World!"
{,#                   Forever, pop and output the top of the stack

This halts by popping an empty stack.
Keg, 13 bytes
Without the -rt flag that you can actually try it online.
“⑮I⅍Gc¡“,\!,/

Try it online!
Keg -rt, 14 bytes
(Doesn't work on TIO as Keg needs a pull)
/00,\!,“⑮I⅍Gc¡

Try it online!
Explanation
       “⑮I⅍Gc¡# Define a space-separated string "Goodble Cruel World"
      ,        # Print it as a character
   ,\!         # Print an exclamation mark
/00            # Perform 0-division, which is an undefined operation

14 bytes: /00,\!,“⑮I⅍Gc¡ using -rt

Stax, 16 bytes
ö╞îö~l%♀~K5╓╖]Æ(

Run and debug it
It's a compressed string literal, followed by a packed Qe.  Q peeks and outputs, and e is eval, which fails.

Zsh, 18!
36/2 bytes, including hello world! for extra credit. Try it online!
echo hello world!
goodbye\ cruel\ $_

NB: The identifier $_ doesn't work with <<< because <<< runs in a sub-shell. Example

Rust, (83) 41.5! bytes
fn main(){print!("Hello World!");"".bytes().nth(1).expect("Goodbye Cruel World!");}

Try it online!
Rust, 41 bytes
fn main(){print!("Goodbye Cruel World!")}

Try it online!

the second one's supposed to crash after it prints Goodbye Cruel World!

ink, 44! bytes
VAR a="Goodbye Cruel World!"
Hello World!->a

Try it online!
Funnily enough, even though variables created in VAR declarations are usually always available even if the VAR statement is unreachable, this program only "works" if that VAR statement comes before the divert - if it doesn't, it's a syntax error instead.

W, 34 33/2 = 16.5 bytes
s|x@`p"Goodbye Cruel"" World!"P+/

Explanation
"Hello"p                            % Print "Hello" to STDOUT without a newline
                       " World!"P   % Output " World" to STDOUT with a newline
        "Goodbye Cruel"          +  % Join "Goodbye Cruel" with the string
                                  / % Perform division upon strings (which is undefined behavior)
                                    % Join the two different snippets of code into a single snippet

The error message provides the source code for debugging purposes.

Archive link for W: https://web.archive.org/web/20191222053946/https://github.com/A-ee/w

W d, 17 bytes
Weirdly enough, I got the same bytecount when I avoided the bonus!
.≈ò♠┐M*óö↑á☼r↕Qá╠%·

Unpacked:
CD(IdK815Ak]T&:Q>`P/

After string-decompression:
Goodbye Cruel World!"P/

Explanation
"Goodbye Cruel World!"   % Define the string "Goodbye Cruel World!"
                      P  % Output the string to STDOUT with a newline
                       / % Divide 0 by the string, which causes an error.
                         % We can't do 0-division because in W,
                         % 0-division is defined as positive infinity.

Archive link for W: https://web.archive.org/web/20191222053946/https://github.com/A-ee/w

Ruby, 41 bytes / 2 = 20.5 bytes!
"Goodbye Cruel World!"&$><<"Hello World!"

Try it online!
$><< is a very useful method of output for Ruby golfing--syntax around it is very forgiving("Goodbye Cruel World!"&puts"Hello World!" would be a syntax error, for example, rather than the runtime exception we need), and << has medium precedence so we can control when it executes more freely.

05AB1E, score 14.5 14!
”Ÿ™‚ï!”,.•1{ø{β?Õ&>₅₁\•™'!«ι

Try it online!

Python 3, Score: 43/2=21.5!
+print("Hello"+"Goodbye Cruel World!"[-7:])

Try it online!

JavaScript: 24.5!
alert('Hello World!');throw'Goodbye Cruel World!'

If alert does not count as a valid output function, then I will use console.log (3 extra points).

Vyxal, 10.5! bytes
`ƛ⁋Ṗ⊍ Crꜝ∞ ƛ€!`kh\!+←

Try it Online!
`...`        # Push 'Goodbye Cruel World!' as a compressed string
     kh\!+,  # Push 'Hello World!', which will be implicitly output even though the program errors.
           ← # Crash by accessing a nonexistent variable, Vyxal logs the stack on erroring

KonamiCode, 356 bytes
v(^^^^^^^>^)>((>))v(^>^>^)>((>))v(^>^>^)>((>))v(^>>)>((>))v(^^^^^^^^^>^^^^^^^^)>((>))v(^>^^>^)>((>))v(^>>^)>((>))v(^^^>^^)>((>))v(^^^^^^^^^>^^^^^^^^^)>((>))v(^>^>^^^^)>((>))v(^>^>^^^^^^^)>((>))v(^>>^)>((>))v(^>>^^^^^^^^)>((>))v(^^^>^^)>((>))v(^>^>^^^^^^^^^)>((>))v(^>^>^)>((>))v(^>^>^^^^)>((>))v(^>>^^^^^^^^)>((>))v(^>>)>((>))v(^^^>^^^)>(>)L(>)<<>((>))B(>)
Sadly, the fact that we have to encode "Goodbye, cruel world!" makes this very long.

JavaScript, 51 / 2 = 25.5! 43 / 2 = 21.5!

"Goodbye Cruel World!"(console.log("Hello World!"))

console.log can be changed to alert and ("") to backticks saving 8 bytes (but I'm not sure this is eligible):

"Goodbye Cruel World!"(alert`Hello World!`)

Welcome to Code Golf! The second one is valid, alert can be used for output under site rules

Thank you for clarifying, I've updated the score to match the shorter version.

Rexx (Regina), 39/2 37/2 bytes = 19.5!
say Hello World!
-Goodbye Cruel World!

Try it online!

C++, 66 bytes
Compiles with VS 2017. A little type confusion for the crash.
extern"C"{int puts(void*);int main=puts("Goodbye Cruel World!");}

Mathematica, 23! Bytes
Print["Hello World!"]/."Goodbye Cruel World!";

Prints the first string then attempts to use the second string as a replacement rule which it isn't so crashes (throws an error message which is equivalent to a crash in Mathematica).
Output:
Hello World

ReplaceAll::reps: {Goodbye Cruel World!} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. >>

C, 42 bytes
Not shorter than Steadybox's C answer, but more resistant to optimization.
main(){ftw(puts("Goodbye Cruel World!"));}

ftw has a short name and its first parameter is a pointer, so the return value from puts makes it crash.

Batch, 20.5 bytes!
@echo Hello World!
"Goodbye Cruel World!

+41 bytes source code
-50% bonus

tcl, 28
error "Goodbye cruel World!"

demo

An anonymous user suggested improving the answer by claiming the bonus with set c World;puts Hello\ $c;Goodbye\ Cruel\ $c!

T-SQL, 22 bytes
[Goodbye Cruel World!]

It tries to execute the nonexistent stored procedure called Goodbye Cruel World! -if there is no SQL Server instance with that dramatic sp-.

Windows .BAT, Score: 19.5!
echo Hello World!&"Goodbye Cruel World!

Yes it works on my CMD

Yabasic, 21.5 bytes!
An anonymous yabasic function that takes no input, prints "Hello World!", then crashes with error "Goodbye Cruel World!"
?"Hello World!"
Error"Goodbye Cruel World!"

Try it online!

Jstx, 22 bytes / 2 = score 11!
₧P4☼♫╗ååÿΔ{îª2╡¬ûÿ~í£▬

Try it online!

Python 3, 33 bytes
print('goodbye cruel world!')

0/0

I believe you need the ! at the end for it to be valid.

oops, thank for reminding me

Why use \n\n0/0 instead of simply ;_?

This answer is extremely similiar to the example one presented in the question.

Forth (gforth), 26 bytes
." Goodbye Cruel World!" =

Try it online!
Prints output text and then crashes with a stack-underflow when it tries to call equals on an empty stack (assumes stack is empty before code is executed).

Forth (gforth), 28.5! bytes
." Hello World!" s" Goodbye Cruel World!" exception throw

Try it online!
The bonus is actually worse than the basic implementation even after the score modifier, due to the required use of exception and throw to get a custom error message in Forth.

Common Lisp, 39 bytes
(format t"Goodbye, cruel world!~%")1/0

I have no real idea of LISP yet, but this should work even without a REPL but with direct eval, I have no way to proof it.

I think TIO's Common Lisp is not a REPL; it works there.

@JonathanFrech fine then, thanks!

Pepe, 195 191 bytes
Saved 4 bytes thanks to u_ndefined.
 reeEeeeEEErEeEEeEEEEreeereeereeEEeeEeereeEEeeeEereeEEEEeeEreeEEeeEeEREeeEeeeeeReeereeEeeeeEEreeEEEeeEereeEEEeEeEreeEEeeEeEreeEEeEEeeReeereeEeEeEEEreeereeEEEeeEereeEEeEEeereeEEeeEeereeeEeeeeEReeee

Outputs exactly Goodbye Cruel World!RERROR!.
And in the debug log: R  # ERROR: R doesn't exist
Try it online!
Pepe, 199 195 bytes
Saved 4 bytes thanks to u_ndefined.
Because the absence of space after the ! annoys me.
reeEeeeEEErEeEEeEEEEreeereeereeEEeeEeereeEEeeeEereeEEEEeeEreeEEeeEeEREeeEeeeeeReeereeEeeeeEEreeEEEeeEereeEEEeEeEreeEEeeEeEreeEEeEEeeReeereeEeEeEEEreeereeEEEeeEereeEEeEEeereeEEeeEeereeeEeeeeEReeeReeee

Try it online!

Replacing Reeee with R works, and saves you 4 bytes,

@u_ndefined I've never seen an absolutely serious comment be so hilarious.

Pip, 19.5 18! (36 bytes/2)
O"Hello";V"Goodbye Cruel".P" World!"

Try it online!
Outputs Hello without a newline; then prints  World!, and finally concatenates and tries to evaluate Goodbye Cruel World! as code. This fails because the unary operator ! needs an operand, leading to the error message
Hit end of tokens while parsing expression
Fatal parsing error while evaluating Goodbye Cruel World!
Fatal error during execution, program terminated.

Batch, 29 Bytes
echo Goodbye Cruel World!
|{

Explanation:
echo Goodbye Cruel World!         //Prints out (echoes) "Goodbye Cruel World!"
|{                                //I just typed random stuff here and hoped it would return an error.

I don't think that's a crash, that's just a command to shutdown the computer

A program that crashes the computer would have the same effect (for /p) but I still get your point and will try to rephrase my answer

I take crash to mean the program ending prematurely or as the question phrases it, an unexpected error. The computer turning off when you use the shutdown command is completely expected behaviour... Would it not  be easier to do something like set /a 1/0?

Oh okay, I'll just put random chars after the echo.

Julia 1.0, 51 bytes long, score 25.5!
print("Hello World!");error("Goodbye Cruel World!")

Try it online!

K4, 21.5
-1"Hello World!";.:`$"Goodbye Cruel World!"

Does not work on variants of K available on TiO, as casting to symbol from string has not yet been implemented
The program prints "Hello, World", then attempts to get the value to which the symbol `Goodbye Cruel World has been set. No value has been set resulting in an error.
q)k)-1"Hello World!";.:`$"Goodbye Cruel World!"
Hello World!
'Goodbye Cruel World!

Python 2, 30 bytes
print"Goodbye Cruel World";1/0

Try it online!
Similar to the Python 3 answer, this prints then tries to evaluate an invalid expression, exiting with a ZeroDivisionError.

Emacs Lisp, 55/2=27.5 bytes!
(error(and(princ"Hello World!")"Goodbye Cruel World!"))

Usage:
$ emacs --batch --eval '(error(and(princ"Hello World!")"Goodbye Cruel World!"))'

Output:
Goodbye Cruel World! # to stderr
Hello World! # to stdout, exits with non zero

JavaScript, 31.5! (does this count?)
(c=console).log("Hello World!");c.error("Goodbye Cruel World!")

Output:
Hello World!          //is printed to stdout
Goodbye Cruel World!  //is printed to stderr
undefined

JavaScript, 37
console.log("Goodbye Cruel World!")=0

Output:
Goodbye Cruel World!
ReferenceError: Invalid left-hand side in assignment

33, 24 bytes
"Goodbye Cruel World!"pd

Try it online!
Simple case. Prints Goodbye Cruel World! then crashes with a floating-point exception caused by the d instruction, which tries to divide 0 by 0. I could just put a character in that 33 doesn't recognise, but where's the fun in that?

Underload, 24 bytes
(Goodbye Cruel World!)S*
Try it Online!
(Goodbye Cruel World!)S | Puts "Goodbye Cruel World!" onto the stack, then pops and prints it.
*                       | Tries to concatenate two items of an empty stack.

Python 3, 33 31
print('Goodbye Cruel World!')
e

very basic
Try it online!
Python 3, 23! 19!
print('Hello World!')
Goodbye Cruel World!

Try it online!

Ahead, 36/2 = 18 bytes!
Prints then divides by zero. The error contents contain a copy of the codeboard, so the string Goodbye Cruel World! will appear.
"!dlroW olleH"W/Goodbye Cruel World!

Try it online!
Ahead, 24 bytes
Same but doesn't get the bonus.
"!dlroW leurC eybdooG"W/

Try it online!

Batch, 36 bytes
Exits with a CRASH!! (the two trailing newlines must not be removed)
@echo(Goodbye Cruel World!
@call ^

Perl 32 Bytes
Try it online!
print"Goodbye Cruel World!";1/0;

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


text:
Golf a bijection within the natural numbers which map the primes to a proper subset of the primes
Definitions

A bijection from a set S to a set T is a function from S to T such that one element in T is mapped by exactly one element in S.
A bijection within a set S is a bijection from S to S.
The natural numbers are the integers which are greater than or equal to 0.
A subset of a set S is a set such that every element in the set is also in S.
A proper subset of a set S is a set that is a subset of S which is not equal to S.

Task
Write a program/function that takes a natural number as input and outputs a natural number. It must be a bijection, and the image of the primes under the program/function, {f(p) : p ∈ ℙ}, must be a proper subset of ℙ, where ℙ is the prime numbers.
Scoring
This is code-golf. Shortest answer in bytes wins. Standard loopholes apply.

original CMC (also by me)

Mathematica, 54 48 bytes
±(t=x_?PrimeQ)=NextPrime@x
±n_:=Abs[n-1]/.t:>x-1

Defines the following bijection:
 n  0, 1, 2, 3, 4, 5, 6,  7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ...
±n  1, 0, 3, 5, 2, 7, 4, 11, 6, 8,  9, 13, 10, 17, 12, 14, 15, 19, ...

The basic idea is to map each prime to the next, to ensure that they are mapped to a proper subset. This results in a "gap" at 2. To fill that gap, we want to map 4 to 2 and then each other composite number to the previous composite number, to "bubble up" the gap. Since 2 and 3 are the only two adjacent primes, we can express both of those mappings as "n-1 or if that's a prime then n-2". Finally, this mapping ends up sending 1 to 0 and we make it send 0 back to 1 by taking the absolute value of n-1.

Do you need to map 0?

@Neil I do, but I've changed the bijection now anyway.

MATL, 21 bytes
Thanks to Emigna for spotting a mistake, now corrected
tZp?_Yq}q:Zp~fX>sG~E+

Try it online!
This implements the following bijection. Write the primes in a row and the non-primes below:
2  3  5  7 11 13 17 ...
0  1  4  6  8  9 10 ...

Then the output is obtained by following the arrow from the input:
2 > 3 > 5 > 7 > 11 > 13 > 17 ...
^
0 < 1 < 4 < 6 <  8 <  9 < 10 ...

Explained code
t       % Implicit input. Duplicate
Zp      % Is it a prime? Gives true / false
?       % If so
  _Yq   %   Next prime
}       % Else
  q     %   Subtract 1
  :     %   Range from 1 to that
  Zp~   %   Is each entry not a prime? Gives an array of true / false
  f     %   Find non-zero entries, i.e. non-primes. Will be empty for input 1
  X>    %   Maximum. This gives the greatest non-prime less than the input.
        %   Will be empty for input 1
  s     %   Sum. This is to transform empty into 0
  G~E   %   Push input, negate, times 2. This gives 2 for input 0, or 0 otherwise
  E     %   Add. This handles the case of input 0, so that it outputs 2
        % End (implicit). Display (implicit)

Jelly, 14 bytes
Æn’’ÆP¿$ÆP?2¹?

Try it online!
Uses Luis's algorithm.

JavaScript (ES6), 82 77 75 bytes
Implements the same logic as Luis Mendo's answer.
f=(n,i=(P=(n,x=n)=>n%--x?P(n,x):x==1||-1)(x=n))=>x?x==n|P(n)-i?f(n+i,i):n:2

Formatted and commented
f = (                   // given:
  n,                    // - n = input
  i =                   // - i = 'direction' to move towards
    (P = (n, x = n) =>  // - P = function that returns:
      n % --x ?         //   - 1 when given a prime
        P(n, x)         //   - -1 when given a composite number
      :                 //
        x == 1 || -1    //
    )(x = n)            // - x = copy of the original input
) =>                    //
  x ?                   // if the input is not zero:
    x == n | P(n) - i ? //   if n equals the input or doesn't match its primality:
      f(n + i, i)       //     do a recursive call in the chosen direction
    :                   //   else:
      n                 //     return n
  :                     // else:
    2                   //   return 2

Demo

f=(n,i=(P=(n,x=n)=>n%--x?P(n,x):x==1||-1)(x=n))=>x?x==n|P(n)-i?f(n+i,i):n:2

for(n = 0; n < 50; n++) {
  console.log(n, '->', f(n));
}

Jelly, 12 bytes
Æn_ḍ@¡ÆP?2»0

Try it online!
How it works
Æn_ḍ@¡ÆP?2»0  Main link. Argument: n (non-negative integer)

      ÆP?     If the input is prime:
Æn                Compute the next prime after n.
              Else:
   ḍ@¡   2        Do once if n is divisible by 2, zero times if not.
  _      2        Subtract 2.
              So far, we've mapped all primes to the next prime, all even integers
              (except 2) to the previous even integer, and all composite, odd,
              positive integers to themselves. In particular, 0 -> 2, but 0 doesn't
              have a preimage, so we need 0 -> 0.
          »0  Take the maximum of the result and 0, mapping 0 -> max(-2, 0) = 0.

Umm, please add an explanation?

@EriktheOutgolfer Added.

Good, now more people can understand this mess...which is actually way too obvious why didn't I think of that?

source: Stack Exchange

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

sort: votes


text:
Garble that string!
Given a string as input, output one or more variants of the string such that:

No character is in it's original position
No character is adjacent to a character that it was originally adjacent to

You can assume this will always be possible for the given string, and will only contain single case alphabetical characters ([a-z] or [A-Z] if you prefer)
Note that duplicates of the same character are not considered unique.
For example, given the input programming, the output cannot contain an m at the 7th or 8th character, and cannot contain a g at the 4th or 11th character (1 indexed)
Example:
Take the string abcdef
The following would be a valid output: daecfb
However the following would be invalid: fdbcae as in this example c and b are still adjacent.
Adjacency also wraps, meaning you could not do fdbeca as f and a are still adjacent.
Testcases:
Note these are not the only valid outputs for the given inputs
Written as input -> output:
helowi -> ioewhl
mayube -> euabmy
stephens -> nhseespt
aabcdeffghij -> dbfhjfigaeca

Scoring:
This is code-golf so fewest bytes in each language wins!

No character is adjacent to a character that it was originally adjacent to. Does order not matter for adjacency? So input "abcd" cannot have "ab" anywhere, and cannot have "ba" anywhere either?

@DrZ214 that is correct

Jelly, 24 23 bytes
ẋ2ṡ2Ṣ€
Ç³Ç¤œ&¬ɓ³=Sȯ
ẊÇ¿

Try it online!
Extremely long by virtue of my being awful at Jelly, but it finally works, at least... still in the process of golfing.
link that generates a list of sorted adjacent pairs:
ẋ2            duplicate argument ("abc" -> "abcabc")
  ṡ2          slices of 2 (-> "ab","bc","ca","ab","bc")
    Ṣ€        sort each

link that tests for invalid permutations:
Ç             get sorted adjacent pairs of argument
 ³Ç¤          do the same for the original input
    œ&        set intersection, then...
      ¬       ...inverse; i.e. do they have no elements in common
       ɓ   ȯ  logical OR the result of that with...
        ³=    elementwise equality with original input, and...
          S   ...sum; i.e. are some characters in the same position

main link:
Ẋ             shuffle the input list
  ¿           while
 Ç            the result of the previous link is truthy

Tested with all testcases in OP, works for all of them

This might be really long for Jelly, but its extremely short for everything else (with the possible exception of 05AB1E, and a few other insane golfing languages.)

yeah it's insanely short, I didn't expect even Jelly to do it this golfily, even 05AB1E's wrong solution that didn't check original char position was 45 bytes

There goes another mod, corrupted by Jelly. How sad.

PHP>=7.1, 147 Bytes
for($a=$argn,$r="^$a[-1].*$a[0]$",$k=0;$v=$a[$k];)$r.="|^.{{$k}}$v|$v".($l=$a[$k++-1])."|$l$v";for(;preg_match("#$r#",$s=str_shuffle($a)););echo$s;

PHP Sandbox Online
PHP>=7.1, 184 Bytes
Use the levenshtein distance instead of a Regex way

for($a=$argn;$v=$a[$k];$r[]=$l.$v)$r[]=$v.($l=$a[$k++-1]);for(;!$t&&$s=str_shuffle($a);)for($t=1,$i=0;$v=$s[$i];$t*=$v!=$a[$i++])foreach($r as$x)$t*=levenshtein($x,$s[$i-1].$v);echo$s;

PHP Sandbox Online
PHP, 217 bytes
Version under 7.1

for($l=strlen($a=$argn),$r=$a[$k=0].$a[$l-1]."|".$a[$l-1]."$a[0]|^{$a[$l-1]}.*$a[0]$";$v=$a[$k];!$k?:$r.="|$v".$a[$k-1],++$k<$l?$r.="|$v".$a[$k]:0)$r.="|^.{{$k}}$v";for(;preg_match("#$r#",$s=str_shuffle($a)););echo$s;

Try it online!

Oh my god it works

Why should it not work? I make every possible regex. If it match shuffle the string till it not match

wait, fails on helowi, outputs ioewlh, i and h are adjacent

@Mayube Okay that should now make the last case safe

Yup, tested with all testcases in the OP, they all work

++$k<$l saves 3 bytes. With PHP 7.1, $l can be rendered obsolete (if you check $a[++$k] instead of ++$k<$l); that should save 16 bytes.

Python 2, 185 bytes
from itertools import*
x=input()
g=lambda m:set(zip(m*2,(m*2)[1:]))
for l in permutations(x):
 if not((g(l)|g(l[::-1]))&(g(x)|g(x[::-1]))or any(a==b for a,b in zip(x,l))):print`l`[2::5]

Try it online!
Prints all valid strings

tested for mayube, stephens and helowi, seems to work for all 3. I need to make an output validator to do some more intensive testing though

Timed out for aabcdeffghij, but that doesn't mean it doesn't work, just that it takes longer than a minute for that input

It takes a LONG time to run "aabcdeffghij" on my machine.  So far >2min.  Also looks like this prints more than one permutation, which is not according to spec.

Rod - You may save some bytes with print next(l for l in permutations(x) if not((g(l)|g(l[::-1]))&(g(x)|g(x[::-1]))or any(a==b for a,b in zip(x,l))))

@NotthatCharles you forgot the \l`[2::5]` =/

i can't count...

Brachylog, 21 bytes
p.jP;?z≠ᵐ&j¬{s₂p~s}P∧

Try it online!
Explanation
I really would have wanted for p.;?z≠ᵐ&j¬{s₂p~s~j} to work for 2 bytes less, but it seems ~j is not smart enough...
p.jP;?z≠ᵐ&j¬{s₂p~s}P∧  Input is a string, say ? = "asdfgha"
p                      Take a permutation of ?, say "sfagadh".
 .                     It is the output.
  j                    Concatenate it to itself: "sfagadhsfagadh"
   P                   Call that string P.
    ;?                 Pair P with the input: ["sfagadhsfagadh","asdfgha"]
      z                Zip, repeating elements of the longer string:
                        [["s","a"],["f","s"],["a","d"],...,["a","g"],["d","h"],["h","a"]]
       ≠ᵐ              Each pair must have different elements.
         &             Start new predicate
          j            Concatenate ? to itself: "asdfghaasdfgha"
           ¬{     }    The following cannot be satisfied:
             s₂        Take a substring of length 2
               p       and permute it.
                ~s     It is a substring of
                   P   P.
                    ∧  Do not unify P with the output.

PHP 7.1, 136 131 bytes
inspired by Jörg´s solution:
for($a=$argn;$c=$a[$k];)$r.="|$c".($d=$a[$k-1])."|$d$c|^.{".+$k++."}$c";while(preg_match("#$a$r#",($s=str_shuffle($a)).$s));echo$s;

Run as pipe with -r or test it online. (Make sure that PHP version 7.1 or above is selected)
Requires PHP 7.1; add 14 bytes for older PHP: Replace $k-1 with ($k?:strlen($a))-1;
(two more bytes for PHP<5.3: $k?$k-1:strlen($a)-1)
breakdown
# A: loop through input to collect sub-expressions
for($a=$argn;$c=$a[$k];)
    $r.="|$c".($d=$a[$k-1])     # 1. pair of characters
        ."|$d$c"                # 2. reversed pair
        ."|^.{".+$k++."}$c";    # 3. $c is at k-th position
# B: shuffle input until regex does not match the result
while(preg_match("#$a$r#",($s=str_shuffle($a)).$s));    # (input as dummy sub-expression)
# C: print result
echo$s;

@JörgHülsermann a lot more ;)

@JörgHülsermann The wrapping case is handled in the first iteration ($c=$a[$k=0], $d=$a[$k-1]) via $s.$s.

Okay nice trick

PHP 7.1, 187 185 172 178 143 bytes
do for($r=str_shuffle($s=$argn),$p=$i=0;$c=$s[$i];$p+=($c==$z)+preg_match("#$a|$b#",$s.$s))$b=strrev($a=$r[$i-1].$z=$r[$i++]);while($p);echo$r;

Run as pipe with -r or test it online. (Make sure that PHP version 7.1.0 or above is selected!)
breakdown
do
    for($r=str_shuffle($s=$argn),   # 2. shuffle input
        $p=$i=0;$c=$s[$i];          # 3. loop through input
        $p+=($c==$z)                        # 2. set $p if char is at old position
            +preg_match("#$a|$b#",$s.$s)    #    or if adjacency occurs in input
    )
        $b=strrev($a=$r[$i-1].$z=$r[$i++]); # 1. concat current with previous character
while($p);                          # 1. loop until $p is falsy
echo$r;                             # 4. print

Fails on input mayube, outputs yeuamb, m and a are adjacent

Also your online tester doesn't seem to be very good, every testcase I've tried just timesout after 3 seconds

@Mayube I forgot to mention: Use PHP version 7.1

Ruby, 110 97 102 bytes
->s{x=s.chars
t=s*2
x.shuffle!while s.size.times.any?{|i|a,b=(x*2)[i,2];a==s[i]||t[a+b]||t[b+a]}
x*''}

Try it online!

This does not follow the rule of "wrapping" adjacency; for example, I got 3594817062 as an output on your TIO link.

@Doorknob fixed!

JavaScript 6, 116 Bytes
f=x=>(h=[...x].sort(_=>Math.random(z=0)-.5)).some(y=>y==x[z]||(x+x).match(y+(q=h[++z]||h[0])+'|'+q+y))?f(x):h.join``

f=x=>(h=[...x].sort(_=>Math.random(z=0)-.5)).some(y=>y==x[z]||(x+x).match(y+(q=h[++z]||h[0])+'|'+q+y))?f(x):h.join``

console.log (f('abcdef'));

Stax, 23 21 bytes
å╘┤‼¬½P¥ë└w↕⌐î◘E{╟u!Ö

Run and debug online!
Thanks for @recursive for saving 2 bytes.
Takes a very long time to run. A more reasonable/feasible version is (just 2 bytes longer)
Ç≡╨áiS║çdèû.#-Gî☺└╨◙σφ+

Run and debug online!
Explanation
Uses the unpacked version to explain.
w|Nc_:=nGyG|*{E-!f+}ch+2B
w                            Loop anything before `}` while
 |N                          Next permutation (starting from the input)
   c_:=                      Index where the current array has the same element as the input (*)
                   }ch+2B    Define a block that finds all contiguous pairs in current string, including the pair `[last element, first element]`
       nG                    Apply the defined block to current string
         yG                  Do the same for the input
           |*                Outer product, contains pairs (which themselves are pairs) constructed from the last two array.
             {   f           Only keep pairs
              E-!            whose two elements have the same set of characters
                  +          Prepend the array at step (*).
                             This is used as the condition for the while loop

Nice.  There's an improvement you can make using G.  You are doing {...}X!...x! to execute the same block twice.  In general, you can rewrite this as G...G   with  }...  at the end of the program, like this.

Thank you. I have seen you used G in another post to save one byte by replacing {...}* with D.... I guess am just still not quite used to it ...

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


text:
Impatiently wait for input
Your task today is to implement a time limit for getting input, a task I've found rather annoying to achieve in most languages.
You will create a program function which prompts the user for input. Immediatly after the user supplies input, print the message input received and end execution/return. However, if the user waits for more than 10 seconds to provide input, output the message no input received and end execution/return.
Input must be from stdin (the console) or equivalent, not function or program arguments, however output can be either to stdout, your function's return value, or any other accepted output method.
You may ask for any amount of  input, it can be a single character, a line, a word, or whatever method is shortest in your language as long as it waits for at least one character.
You must output as soon as the input is received, not after the 10 seconds have passed.
After 10 seconds have passed, you must end, you cannot continue waiting for input after no input received has been printed.
You may assume that input is not passed in the time between 10 seconds elapsing and text being printed to the screen, as this is an extremely small window. You may also assume that your language's builtin equivalent of sleep is consistently, absolutely perfect.
This is code-golf, fewest bytes wins!

+1 just for the nice touch to prevent golfing languages from using their dictionary. Oh, and great challenge too.

@Adám unless your language has a builtin read with timeout, I think the only good way to do this is OS/Thread magic, which most golfing languages can't do anyway.

Now I have to rewrite my program. Was almost ready to post... ;-)

What's the allowance either side of the 10 second wait period? I've assumed +-0.1 at the moment.

@TheLethalCoder You can assume your language's equivalent of sleep functions perfectly 100% of the time.

@Phoenix I ask because there is a small race condition in my code, that in reality will probably never get hit but it is possible.

@TheLethalCoder No, that's fine.

Some languages can't read from STDIN (e.g. Applescript).  Do they get a waiver?

@DigitalTrauma yes, the restriction was intended to prevent reading from args, where the challenge doesn't make sense.

I would love to see a Python answer to this.

@Lembik Mego came up with one in chat, you can ask him about it.

How long does the input we take have to be? Could it be, say, 1 character?

@ScottMilner yes, read the question

@Lembik There you go, a Python answer.

@Adám: I'm working on a golfing language string compressor that makes use of real-world input to work out which words are most common. It's not released yet, but I checked the dictionary; amazingly, recieved is actually in there (at a similar frequency to words like businesswoman, microfossils, and putrescine).

Phoenix, could you let me know if my answer is valid? I'm not 100% convinced meself!

@Shaggy yep, seems to work just fine.

bash, 38 bytes
read -t10||a=no;echo $a input received

This uses the -t (timeout) option to bash's read, which causes it to fail and return a nonzero exit code if no input is given in the specified number of seconds.

It is supposed to say "(no )input recieved" which importantly obstructs golfing languages with dictionaries.

@Adám Actually that's a typo

@Phoenix Noooo!

Why do a=no then $a? is there a purpose? EDIT I got it I didn't read the question properly

Haskell, 97 89 bytes
import System.Timeout
timeout(10^7)getChar>>=putStr.(++"input received").maybe"no "mempty

If timeout times out it returns Nothing and Just Char (Char, because we're using getChar) otherwise. This return value is converted to "no " or "" by function maybe "no " mempty. Append "input received" and print.
Edit: @BMO suggested maybe and saved some bytes.

Doesnt seem to run correctly in ghci.

@maple_shaft: Within ghci you have to bind g with let: let g Nothing="no ";g _="", then the function call timeout.... works fine for me.

You can replace g by maybe"no "(pure"") which is shorter and you can even inline it - saving you 6 bytes.

@BMO: Nice! mempty instead of (pure"") is even shorter.

Very nice, that's really clever!

POSIX C99, 71 63 bytes
main(){puts("no input received"+3*poll((int[]){0,1},1,10000));}

Ungolfed:
#include <unistd.h>
#include <poll.h>
#include <stdio.h>
int main()
{
  struct pollfd pfd;
  pfd.fd = STDIN_FILENO;
  pfd.events = POLLIN;
  puts("no input received"+3*poll(&pfd,1,10000));
}

Since poll will return 1 in case of success, we multiply the result by 3 and shift the string accordingly. Then, we use the fact that struct pollfd has the following layout:
     struct pollfd {
     int    fd;       /* file descriptor */
     short  events;   /* events to look for */
     short  revents;  /* events returned */
 };

and that STDIN_FILENO is 0, POLLIN is 1 to replace pfd with int pfd[] = {0,1}, which we finally make a compound litteral (as allowed by C99).

You need to specify that this targets POSIX, as the poll.h header is not part of the C99 language standard.

Applescript, 113
Applescript doesn't really do reading from STDIN.  Hopefully a display dialog is acceptable here:
({"","no "}'s item((display dialog""default answer""giving up after 10)'s gave up as integer+1))&"input received"

APL (Dyalog), 41 40 bytes
'no input received'↓⍨{3*⍨⎕RTL←10::0⋄3⊣⍞}

This is an anonymous tacit function which needs a dummy argument to run.
'no input received' the full string
↓⍨ drop as many characters from the front of that as the number returned by the
{ anonymous explicit function (⍵ denotes the argument)
 ⎕RTL←10 set Response Time Limit to ten seconds
 3*⍨ raise that number (ten) to the power of three (a thousand means "all")
 :: upon those exceptions (all),
  0 return 0
 ⋄ try:
  ⍞ get input
  3⊣ discard that and instead return 3
} end of function (note that the argument ⍵ was never mentioned)

Perl, 74 67 bytes
$m="input received";$SIG{ALRM}=sub{die"no $m\n"};alarm 10;<>;say$m

Old Version
$m="input received";$SIG{ALRM}=sub{die "no $m\n"};alarm 10;<stdin>;say $m;

(Run via perl -M5.10.1 ...)

No trailing newline is necessary in output, so you can cut \n.

Welcome to PPCG!

Actually you don't need -M5.10.1. You can just substitute -e with -E. (if you needed -M5.10.1, you would have to add a penalty to your score)

@Phoenix, the \n is there because of die's behavior: “If the last element of LIST does not end in a newline, the current script line number and input line number (if any) are also printed, and a newline is supplied.” So without it would display “no input received at -e line 1.”. But of course, it could be a literal line break in the string. Beside that, the spaces between die and say and their parameters are not needed. Same for the final ;. And <> is enough to read from standard input.

@BradGilbertb2gills I believe -M is a version flag, which makes it exempt from penalty.

If you eval the read from STDIN, you can avoid needing a die message. In fact, a runtime error works just as well: $SIG{ALRM}=sub{&0};alarm 10;say'no 'x!eval'<>','input received'.

63: '$_="input received";$SIG{ALRM}=sub{die"no $m\n"};alarm 10;<>;say' (replace \n by literal newline)

Perl 6,  72  66 bytes
my $s='input received';Promise.in(10).then:{say "no $s";exit};get;say $s

Try it with no input
Try it with input
my$s='input received';start {sleep 10;say "no $s";exit};get;say $s

Try it with no input
Try it with input
my $s = 'input received'; # base message

start {         # create a Promise with a code block
                # that is run in parallel
  sleep 10;     # delay for 10 seconds
  say "no $s";  # say ｢no input received｣
  exit          # exit from the process
}

get;            # get a line from the input
say $s          # say ｢input received｣

"my ess is input recieved -- promise in 10 then say 'no ess' and exit or get say 'ess'"

Can you remove the space between start and {?

@Phoenix That would be parsed as associative indexing on a sigilless variable named start, so no.

Your TIO links appear not to work anymore.

@Pavel, Fixed, just had to make the dummy test class a subtype of IO::Handle and call .new on it

You also don't need spaces before $s.

C#, 180 171 148 131 bytes
()=>{var t=new System.Threading.Thread(()=>{System.Console.ReadKey();});t.Start();return(t.Join(10000)?"":"no ")+"input recieved";}

Saved 17 bytes thanks to @VisualMelon.
Full/Formatted version:
class P
{
    static void Main()
    {
        System.Func<string> f = () =>
        {
            var t = new System.Threading.Thread(() =>
            {
                System.Console.ReadKey();
            });
            t.Start();

            return (t.Join(10000) ? "" : "no ") + "input recieved";
        };

        System.Console.WriteLine(f());
        System.Console.ReadLine();
    }
}

Why namespace and not a using directive?

@Phoenix they would need a namespace anyway so they save all the bytes of the using

Why did you save the crucial part as an Action and execute it afterwards? I can't really see the question specifying this.

@Snowfire Because an Action is cheaper than a full program

Can save quite a bit by using the return value from Thread.Join(int), (rid of c, lose braces, etc. etc.): var t=new System.Threading.Thread(()=>System.Console.ReadKey());t.Start();return(t.Join(10000)?"":"no ")+"input recieved"; (VB.NET already seems to do this)

@VisualMelon Awesome didn't even know it returned a value haha!

@TheLethalCoder Yes, it returns a value based on if it timed out. see vb.net sample below (although it's .net's idea, not vb.net's ;-)

I'm not sure on C#'s formatting for expontentiation, could you swap 10^4 out for 10000?

@TaylorScott I can do 1e4 but that is a double and I'd need an int so I'd have to do (int)1e4 :( Nice idea though

What about using a type literal suffix for long (L) or uint (U)? if this is implicitly converted or if uint extends int would it let you drop a byte? (ie use 1e4U)

@TaylorScott Can't seem to get if to work

Well thats a shame :( - was worth the shot

TI-BASIC, 84 77 bytes
-7 thanks to @kamoroso94
:startTmr→T         //Start Timer, 5 bytes
:Repeat checkTmr(T)=10 or abs(int(.1K)-8)≤1 and 1≥abs(3-10fPart(.1K  //Loop until the timer is 10 seconds or a number key is pressed, 32 bytes
:getKey→K           //get key code, 4 bytes
:End                //end loop, 2 bytes
:"NO INPUT RECEIVED //Push string "NO INPUT RECEIVED" to Ans, 18 bytes
:If K               //If input was received, 3 bytes
:Disp sub(Ans,3,15  //Diplay "INPUT RECEIVED", 9 bytes
:If not(K           //If no input, 3 bytes
:Ans                //Display "NO INPUT RECEIVED", 1 byte

Waits until a number is pressed.
I am trying to figure out how to golf the sequence {72,73,74,82,83,84,92,93,94}. It is taking up a lot of space.

If you want to wait for just any key, then Repeat K or 10=checkTmr(T would do.

Also, the last 4 lines could be shortened to
:4-3not(K:sub("NO INPUT RECEIVED",Ans,18-Ans

@bb94 I don't really want to wait for just any key, since not all of those would actually input a character. It would be like waiting for the Shift key on a computer. Also, shortening the last 4 lines with your method actually gives the same byte count as mine. I like your method, though.

You could check for any key that isn't 21 or 31.

After or in your repeat statement, use this instead for -7 bytes: abs(int(.1K)-8)≤1 and 1≥abs(3-10fPart(.1K

AHK, 67 65 bytes
2 bytes saved by Blauhirn
InputBox,o,,,,,,,,,10
s:=ErrorLevel?"no ":
Send %s%input received

AHK has a built-in timeout for input boxes.
I tried to get clever and use !o instead of ErrorLevel but that fails if the user inputs a falsey value.
Almost half of the answer is just the command names and fixed text.

What are all the commas for?

@Phoenix Probably eliding arguments to InputBox

@Phoenix Timeout is almost the last parameter: InputBox, OutputVar [, Title, Prompt, HIDE, Width, Height, X, Y, Font, Timeout, Default]

two chars shorter: s:=errorLevel?"no ":

@Blauhirn Gah! I'm an idiot. Thanks.

NodeJS, 105 103 101 bytes
-2 bytes thanks to @apsillers
-2 bytes by moving console.log() into exit()
with(process)stdin.on('data',r=x=>exit(console.log((x?'':'no ')+'input received'))),setTimeout(r,1e4)

Run by saving to a file and running it with node or run it straight from the command line by doing node -e "<code>"

@apsillers Yup, good catch.

@apsillers I was about to edit again to actually move the console.log() call into the parameter of exit(). That's two less, now.

Go, 149 bytes
package main
import(
."fmt"
."time"
."os"
)
func main(){
o:="input received"
go func(){Sleep(1e10)
Print("no "+o)
Exit(0)}()
i:=""
Scan(&i)
Print(o)}

JavaScript (ES6) + HTML, 86 84 82 79+11 = 97 95 93 90 bytes
setTimeout(oninput=_=>i.remove(alert(`${i.value?"":"no "}input received`)),1e4)

<input id=i

2 bytes saved thanks to apsillers pointing out that I'm dumb!

Try it
Requires a closing > on the input in order to work in a Snippet.

setTimeout(oninput=_=>i.remove(alert(`${i.value?"":"no "}input received`)),1e4)
<input id=i>

1e5 is 100,000 or 100 seconds, 1e4 is 10 seconds

Oops! Well spotted, thanks, @PunPun1000

Wouldn't it be shorter to write 10 instead of 1e4?

@musicman523, 10 would be 10 milliseconds, the challenge challenge specifically says 10 seconds, which is 10000 milliseconds, hence 1e4.

My bad, forgot that 10 != 1e4 because I'm a fool

@musicman523 Easily done if your language's lowest measurement of time is in seconds, not milliseconds.

I'm not sure what the f= is doing in oninput=f=...; you don't use f anywhere. Can it simply be removed?

@apsillers, the only reason it's there is because I'm dumb! :D The event handler was originally outside the timer and I simply forgot to remove the f= when I moved it inside. Will update when I get back to a computer.

Python 3, 158 bytes
import os,threading as t,time
def k(t=10):time.sleep(t);print("No input received"[(10-t)//3:]);os.kill(os.getpid(),t)
t.Thread(None,k).start()
if input():k(0)

Welcome to PPCG!

VB.Net - 174 bytes
Module M
Sub Main()
Dim t=New Threading.Thread(Sub()Console.Read()):t.Start():Console.WriteLine(If(t.Join(10000),"","no ") & "input received"):End
End Sub
End Module

COBOL version coming tomorrow ;-)

I'm not sure what the advantage is of combining lines with :. That takes the same number of bytes as a line break, so it just decreases readability without improving the golf score.

@CodyGray I believe that the : line break substitution may be so that the treading call may be declared inline without repeating - but that said I am not positive, my main language is VBA which does not support threading or reading from the console immediate window asside from at the time of function definition or calling :P

PowerShell, 110 bytes
$s1=date;while(![console]::KeyAvailable-and($i=((date)-$s1).seconds-lt10)){}
"{0}input received"-f(,'no ')[$i]

Python3, 100 89 83 71 bytes
import pty
print("no input received"[3*any(pty.select([0],[],[],10)):])

First try at golfing.
-4 for any(), -7 for slicing, thanks @user2357112!
-6, get select() from pty instead of select.

You can cut some bytes out by slicing a "no input received" string: "no input received"[3*bool(...):].

You can also use any(...) instead of bool(...[0]).

-New User: "on Windows it throws ModuleNotFoundError: No module named 'termios'"

The pty module is only available on linux platforms, but I'm only using it because its name is short and it makes select available. Version 2 probably works better on Windows.

Scratch 2/3.x, 41 points (Explanation)

1: When GF clicked
1: ask [] and wait
1 + 14 chars: say [input received]
1: stop [all v] (note: since "all" was its default setting I counted the block as 1)
1 + 2 digits: wait (10) seconds
1 + 17 chars: say [no input received]
1: stop [all v]

Welcome to PCG!

Scratch 3.0 (scratchblocks3 syntax), 129 bytes/40 points
Beats @Syntax Error's answer by 1 point, but loses to it by 8 bytes.
define
broadcast[w v
ask[]and wait
say[input received
stop[all v
when I receive[w v
wait(10)secs
say[no input received
stop[all v

Ungolfed:
define // custom blocks (functions) do not need names. functions are shorter than programs when counting bytes, because programs that run require "when gf clicked"
broadcast [w v]
ask [] and wait // contrary to what the name of this block would suggest, there is no "ask [] (without waiting)" block - this is why the broadcast is necessary to allow other blocks to run while this block is waiting
say [input received]
stop [all v]

when I receive [w v]
wait (10) secs // although the actual block reads 'seconds', 'secs' is valid in scratchblocks syntax
say [no input received]
stop[all v]

Tcl, 99 bytes
after 10000 {set () no}
vwait [fileevent stdin r {gets stdin (x)}]
puts [lappend () input received]

SmileBASIC 3, 74 bytes
"Accepts input" by waiting for any button press (that should count as input.)
M=MAINCNT@L
N=MAINCNT-M>599CLS?"NO "*N;"INPUT RECEIVED
ON N+BUTTON()GOTO@L

Output should be "(no) input received", not "INPUT (NOT) RECEIVED"

><>, 43 + 6 = 49 bytes
a/!/i0(?\~"input recieved"r>o<
o "\?:-1/r"n

Try it online!
+5 for the -t.08 flag, which sets the tick to 0.08 seconds, and +1 for the a flag, which counts whitespace and skipped instructions as ticks.
The program checks for input about once every second, and exits the loop if input is detected. If input is not received, it exits the loop from the bottom, appending no to the beginning of the string. The initial / is to ensure that the last check for input is exactly on the 10 second mark.
It then takes about 5-6 seconds to print the string itself.

You can use a single flag, -at.08 to save a byte.

Java 1.4+, 284 bytes
import static java.lang.System.*;public class X{public static void main(String[]x){new Thread(){public void run(){try{Thread.sleep(10000L);}catch(Exception e){}out.print("no input recieved");exit(0);}}.start();new java.util.Scanner(System.in).nextLine();out.print("input recieved");}}

Ungolfed:
import static java.lang.System.*;

public class InputAndWait {
    public static void main(String[] x) {
        new Thread() {
            public void run() {
                try {
                    Thread.sleep(10000L);
                } catch (Exception e) {
                }
                out.print("no input recieved");
                exit(0);
            }
        }.start();
        new java.util.Scanner(System.in).nextLine();
        out.print("input recieved");
    }
}

Please don't suggest Version-specific Java improvements, this is a generic Java answer that works in all currently stable Java Environments (1.4 and above).

Very freaking wordy... The catch is required, can't throw it. System import shaves off like 5 bytes... Overloading is also wordy, so it ends up a wordy poorly-golfed-looking mess.

Does it have to be 10000L and not 10000? I thought ints cast to longs automatically.

Julia 0.6, 78 bytes
Longer than I expected. See comments for "no input recieved" TIO link.
s="input recieved"
Timer(x->(show("no "*s);exit()),10)
readline(STDIN)
show(s)

Try it online!

It doesn't block on TIO because it's reading from a file. It hits EOF and finishes instantly. If you pipe a process that never emits newlines into the program on TIO, it'll block: https://tio.run/##JcqxDoIwEIDhvU9x6ULPCNXFxejk4uIiowvaSzgDLekVReO7V4Pb/yX/W9qcXyTwgRShdFBcfPGDDUOy97HjZmOv7P8JFfthTFXikLPs9CyIdGN6kNOq5p6imcq9kTY8jfYB9EJwSxMng7hcr1BFalzHnsy5PhxPqOZT8As

SmileBASIC, 74 73 bytes
M=MAINCNT
WHILE!I*M>MAINCNT-600I=INKEY$()>"
WEND?"no "*!I;"input received

Takes 1 character of input.
And a 39 byte solution which probably isn't valid (doesn't actually accept text input, just has an OK button that you can press)
?"no "*!DIALOG("",,,10);"input received


text:
Is that string garbled?
Mayube recently posted Garble that string. However, humans aren't too good at checking whether a string is actually garbled or not. (Actually, that's an understatement, we are really bad at it.) So, let's save some time making test cases, and see if a string is actually garbled.
Input
Two strings, containing only lowercase, or only uppercase letters, your choice.
Output
Truthy/falsey based on if the second string is a garbled version of the first one (or vice-versa, I believe).
A string is garbled if (same as original challenge):

No character is in it's original position
No character is adjacent to a character that it was originally adjacent to

Note that duplicate characters keep rules from all other copies of them.
Adjacency also wraps from one end to the other, so for abcd, a is considered adjacent to d.
Test Cases
I really hope these are right. Mostly copied from the other challenge.
mayube, euabmy truthy
aabcdeffghij, dbfhjfigaeca truthy
abcde, badce falsey
abcde, dbeca falsey
aaa, aaa falsey
stephen, nhseept falsey
stephens, nhseespt truthy
helowi, ioewlh falsey

don't forget to mention that adjacency wraps, meaning the 2 ss in stephens are adjacent

This is a borderline duplicate of the other challenge—the bulk of the code for that challenge implements this, so answers can be trivially modified and posted here by removing the "shuffle repeatedly" or "generate permutations and filter" part.

@Doorknob that's very possible - the community can decide. Personally, I'd prefer that at least one answer came in so that it's there to validate the test cases for the other challenge, but it's not up to me.