| Bytes | Lang | Time | Link |
|---|---|---|---|
| 822 | Bespoke | 250807T084410Z | Josiah W |
| 065 | TeX | 250517T132052Z | John |
| 112 | ZPL Zebra Programming Language | 170307T234444Z | Grant Mi |
| 026 | Vyxal | 250422T111952Z | emanresu |
| 035 | Vyxal 3 | 250422T101540Z | Themooni |
| 055 | AWK | 250421T175312Z | xrs |
| 065 | Tcl | 170524T165924Z | sergiol |
| 068 | Setanta | 240908T181857Z | bb94 |
| nan | Chicken | 240906T120358Z | None1 |
| 051 | /// | 240905T200927Z | autumn |
| 068 | Swift | 240317T003445Z | macOSist |
| 134 | Rust | 240206T174521Z | Joonas |
| 088 | Windows Batch Scripting | 240205T024000Z | vengy |
| 036 | Japt R | 240121T165252Z | noodle p |
| 045 | Uiua | 240201T200047Z | Adelie |
| 096 | TypeScript's type system | 240121T161317Z | noodle p |
| 051 | Zsh | 240121T111616Z | pxeger |
| 066 | PowerShell | 230414T210132Z | James Fl |
| 046 | Crayon | 151009T161444Z | ETHprodu |
| 066 | beeswax | 160107T185744Z | M L |
| 100 | Golisp | 160619T213551Z | TuxCraft |
| 031 | Jelly | 161126T175159Z | Erik the |
| 114 | tinylisp | 220205T162506Z | Axuary |
| 059 | Python | 141013T123436Z | Falko |
| 115 | Quipu | 210901T015257Z | DLosc |
| 112 | Barrel | 210522T020852Z | LorenDB |
| 064 | AWK | 180111T201618Z | Robert B |
| 680 | Deadfish~ | 210516T081925Z | wasif |
| 067 | BRASCA | 210518T093328Z | SjoerdPe |
| 030 | Vyxal j | 210517T073902Z | wasif |
| 145 | Branch | 210417T233129Z | hyperneu |
| 211 | Duocentehexaquinquagesimal | 210414T202638Z | Makonede |
| 064 | Sandwich | 210415T145711Z | karx |
| 079 | JavaScript Node.js | 201213T185651Z | sech1p |
| 210 | naz | 201213T035739Z | sporebal |
| 063 | Julia | 201020T151816Z | amel |
| 039 | 05AB1E | 200923T225300Z | Makonede |
| 089 | Scala | 141014T055401Z | mackayve |
| 059 | Scala | 200907T133956Z | user |
| 9660 | International Phonetic Esoteric Language IPEL | 200626T014859Z | bigyihsu |
| 046 | /// | 200625T231742Z | nph |
| 034 | W d | 200122T104806Z | user8505 |
| 076 | JavaScript | 200122T114210Z | Lebster |
| 078 | Wren | 200122T100045Z | user8505 |
| 049 | GolfScript | 200122T093051Z | user8505 |
| 028 | Stax | 190914T152214Z | Khuldrae |
| 074 | Keg | 190914T133249Z | user8505 |
| 033 | Stax | 190906T185251Z | Oliver |
| 038 | Japt | 170306T194215Z | Oliver |
| 029 | 05AB1E | 190906T162158Z | Grimmy |
| 055 | Gol><> | 190222T000825Z | KrystosT |
| 087 | TSQL | 141013T180938Z | MickyT |
| 681 | Excel VBA | 170801T132318Z | Taylor R |
| 151 | C gcc and aplay | 180730T233009Z | user7740 |
| 251 | Cubically | 181006T120811Z | u-ndefin |
| 309 | A0A0 | 181005T191208Z | user8317 |
| 045 | MathGolf | 181005T063357Z | maxb |
| 093 | MBASIC | 181003T194738Z | wooshiny |
| 054 | Noether | 180730T163009Z | Beta Dec |
| 377 | brainfuck | 180727T104544Z | Dorian |
| 040 | Pyth | 180727T172133Z | Tornado5 |
| 056 | Charcoal | 180727T101337Z | Charlie |
| 373 | Whitespace | 180727T085553Z | Kevin Cr |
| 074 | Python 3 | 180726T185432Z | Ben |
| 056 | R | 180726T145009Z | JayCe |
| 224 | C\C++ Preprocessor | 170419T124621Z | Khaled.K |
| 057 | jamal | 180315T210203Z | manatwor |
| 030 | Stax | 180312T155904Z | Weijun Z |
| 054 | Attache | 180312T133027Z | Conor O& |
| nan | Aceto | 180312T032835Z | drham |
| 082 | Python 2 | 180311T193138Z | Allen Fi |
| 055 | Add++ | 180310T210916Z | caird co |
| 135 | C++ | 180111T174625Z | Colin Ro |
| 043 | Canvas | 180217T045828Z | hakr14 |
| 073 | REXX | 180216T121405Z | Srinivas |
| 029 | SOGL V0.12 | 180216T122022Z | dzaima |
| 125 | Java | 141013T162742Z | Stretch |
| 055 | Sed | 141013T124411Z | manatwor |
| 056 | Golfscript | 141013T164452Z | Beta Dec |
| 078 | TSQL | 180111T161452Z | BradC |
| nan | Unary | 170904T054148Z | Husnain |
| 049 | Pyth | 170803T061235Z | Mr. Xcod |
| 052 | Brachylog | 170801T121237Z | Erik the |
| 813 | Cubically | 170801T171223Z | TehPers |
| 058 | VBA | 170801T123127Z | Taylor R |
| 047 | IDL Interactive Data Language – | 170614T012223Z | Dick Jac |
| 069 | Braingolf | 170606T074703Z | Mayube |
| 120 | Minecraft | 170606T071331Z | LyricLy |
| nan | # | 170524T170628Z | caird co |
| 052 | Fourier | 170524T170600Z | Beta Dec |
| 507 | Python | 170524T050046Z | Alex |
| 169 | Common LISP | 141014T003003Z | Palageri |
| 072 | Batch | 170427T131023Z | Engineer |
| 185 | COBOL | 170427T110205Z | johan |
| 593 | Brainfuck | 141013T175008Z | Varun Ap |
| 058 | Any love for PHP? | 141013T183119Z | MonkeyZe |
| 065 | PHP | 170307T230142Z | Titus |
| 092 | C++ | 170421T130010Z | jdt |
| 074 | C | 170419T111938Z | Khaled.K |
| 103 | C# LinqPad | 141015T221437Z | Qwertiy |
| 049 | Sprects | 151009T174325Z | DanTheMa |
| 228 | ArnoldC | 141015T183344Z | Wasi |
| 053 | TIBasic | 141013T193400Z | Stretch |
| 080 | Edited Processing.js | 170306T215751Z | user6318 |
| 073 | C | 141013T135959Z | V-X |
| 059 | Underload | 170306T200126Z | Esolangi |
| 036 | Vim | 170306T164747Z | user4180 |
| 070 | JavaScript | 170109T001942Z | Julian L |
| 045 | Vim | 141016T072321Z | Angelo F |
| 036 | 05AB1E | 161204T224600Z | acrolith |
| 044 | Pushy | 161128T182017Z | FlipTack |
| nan | Mathematica barcode birthday wishesway too many bytes | 141014T002501Z | DavidC |
| 066 | Reng | 160620T014940Z | Conor O& |
| 048 | /// | 160619T203324Z | Erik the |
| 076 | F# | 160209T155831Z | Roujo |
| 052 | jq | 150722T171652Z | manatwor |
| 057 | Seriously | 160108T000416Z | TanMath |
| 047 | Retina | 160108T175001Z | Timwi |
| 066 | Staq | 160108T173448Z | M L |
| 056 | Milky Way 1.6.5 | 160107T210356Z | Zach Gat |
| 070 | Mouse2002 | 151230T203142Z | cat |
| 091 | C# | 151230T143015Z | Goose |
| 078 | Stringy | 151011T163734Z | m654 |
| 116 | Fishing | 151009T232241Z | Arcturus |
| 076 | G* | 151009T165240Z | m654 |
| 042 | Bubblegum | 151008T134309Z | Dennis |
| 088 | HPPPL HP Prime Programming Language | 150808T141709Z | M L |
| 084 | CMD 84 Bytes | 150629T035227Z | unclemea |
| 068 | Swift | 150722T161235Z | Kametrix |
| nan | 141014T010828Z | i alarme | |
| 157 | ><> | 150703T200712Z | jado |
| 3429 | Shakespeare Programming Language | 150702T231245Z | Rodolfo |
| 072 | Lua | 150702T033730Z | mlepage |
| nan | Cardinal | 150628T113904Z | M L |
| 119 | Qt 5.4 qmake pro file | 150701T161559Z | ForemanB |
| 042 | CJam | 141013T114051Z | Optimize |
| 070 | JS 70 Bytes | 150630T192503Z | Thomas J |
| 074 | C | 141018T180547Z | Stefano |
| 066 | SAS | 150629T210514Z | Fried Eg |
| 076 | ><> 76 Bytes | 150629T194455Z | Fongoid |
| 067 | JMP/JSL | 150629T161527Z | Fried Eg |
| 045 | K | 150628T204728Z | JohnE |
| nan | Casio CFX9850G | 150615T180514Z | M L |
| nan | Julia | 150614T013045Z | M L |
| 182 | LaTeX | 141030T003213Z | archaeph |
| 059 | sh | 141027T201159Z | user344 |
| 070 | TeX | 141027T195941Z | user344 |
| 073 | C# | 141015T000223Z | Magic Mi |
| 107 | C++ | 141022T173946Z | nwp |
| 090 | Befunge | 141014T203404Z | r3mainer |
| nan | 141014T040802Z | Jae | |
| 042 | Pyth | 141021T193401Z | izzyg |
| 045 | APL | 141021T124241Z | Moris Zu |
| 115 | Delphi | 141017T085251Z | R-D |
| 139 | Delphi | 141016T151331Z | R-D |
| 2391 | Deadfish | 141014T043006Z | Sp3000 |
| 060 | Common Lisp 62 | 141015T083716Z | coredump |
| 071 | Intersystems Cache M | 141020T015447Z | LMSingh |
| 059 | PowerShell | 141014T124351Z | SomeShin |
| 054 | Rant | 141018T175609Z | Berkin |
| 076 | Clojure 104 | 141016T032058Z | Bob Jarv |
| 083 | C# | 141015T054510Z | Tyress |
| 078 | PHP | 141013T174647Z | g.carval |
| 079 | Clojure | 141015T221951Z | tjb1982 |
| 071 | Powershell one liner 73 | 141013T225407Z | Dave Nee |
| nan | 141014T165134Z | MegaTom | |
| 082 | Javascript | 141016T215156Z | pllee |
| 061 | Falcon | 141016T050655Z | globby |
| 099 | VBA | 141016T203203Z | RubberDu |
| 162 | C# Full program | 141016T125247Z | Brandon |
| 087 | Rexx | 141016T121717Z | aja |
| 075 | VBScript | 141016T061115Z | Manuel A |
| 065 | Mathematica | 141016T034228Z | Ryan Pol |
| nan | 141015T222013Z | Qwertiy | |
| 062 | PowerShell | 141015T201834Z | DarkAjax |
| nan | 141015T142800Z | Max Klei | |
| 053 | J | 141015T132449Z | jpjacobs |
| 061 | Python 3 | 141014T092003Z | Hennep |
| 096 | Lua | 141015T103245Z | Peabnuts |
| 062 | Bc | 141015T083607Z | manatwor |
| 151 | Marbelous | 141015T034733Z | es1024 |
| 109 | B | 141015T022843Z | Alex Cel |
| 136 | C++ | 141015T020935Z | android9 |
| 077 | Visual FoxPro | 141015T013836Z | Alejandr |
| 064 | Groovy | 141014T193338Z | Will Lp |
| 079 | Railo CFML | 141013T225051Z | Regular |
| 083 | Swift | 141014T164626Z | dKrawczy |
| 075 | TSQL MS compliant | 141014T161307Z | Kyle Hal |
| 062 | PHP 67 63 | 141014T122327Z | Alessand |
| 098 | Rust | 141014T013651Z | Tris - a |
| 103 | Befunge | 141014T112022Z | karhell |
| 054 | GolfScript | 141013T170448Z | manatwor |
| nan | 141014T075221Z | Abbas | |
| 069 | R | 141014T065046Z | plannapu |
| 083 | JS | 141013T133646Z | l2aelba |
| 121 | Var'aQ | 141014T061140Z | Beta Dec |
| 072 | Lua 91 | 141014T052056Z | skwerlma |
| 078 | Cobra | 141014T040113Z | Οurous |
| 044 | J | 141014T015117Z | marinus |
| 085 | Python | 141014T014952Z | sdamashe |
| 055 | Burlesque 55 Characters | 141014T010926Z | AndoDaan |
| 087 | C | 141014T001351Z | millinon |
| 087 | Clojure | 141013T233319Z | Michael |
| nan | 141013T232200Z | Sylweste | |
| 8176 | BBC BASIC | 141013T230216Z | Level Ri |
| 079 | PowerShell | 141013T214308Z | Krove |
| 052 | sh | 141013T154246Z | Digital |
| 058 | Perl | 141013T203926Z | hmatt1 |
| 048 | APL | 141013T193722Z | marinus |
| 070 | R | 141013T172140Z | bdzimmer |
| 073 | JavaScript | 141013T165220Z | xem |
| 073 | JavaScript | 141013T144319Z | NinjaBea |
| 051 | GNU dc | 141013T155446Z | Digital |
| 054 | Ruby | 141013T140430Z | Martin E |
| 056 | Ruby | 141013T140347Z | britisht |
| 046 | CJam | 141013T112538Z | Martin E |
Bespoke, 822 bytes
the year Twenty-TwentyFive:my ideas initially originated of specially-developed programs nearly equivalent to writings of an odd structure
a certain language for"coding"sentences using ordinary words carefully organized
these commands in the words being lengths-based permits arbitrary vocabulary sets to construct the code
this invention I tailormade,I concluded:this I am calling Bespoke
Jan Thirteen was my languages birthday,regardless of how I continued developing a ton after this
from my past,Poetic is a different invention I(in hindsight)invented using similar ways,but I used as my basis of that an idea that exists
is there an idea left that no one is having,however?perhaps nothing thought is ever new;but I did use improved design within my new one
I,for its birthday,celebrated it with running its software/s
Outputs with a trailing newline.
This program works by pushing many large numbers onto the stack, and printing out its base-133 "digits" as characters until they reach 0. (I chose base 133 because it just so happens to result in numbers that take fewer bytes to represent in Bespoke.)
- 60252998602822 =
"to You\n" - 17836958558235575742934491011277 =
"Happy Birthday " - 329802311354424621129857431 =
"Dear Bespoke\n"
TeX, 65 Bytes
\def~{\a to You
}
\def\a{Happy Birthday }
~~\a Dear \TeX
~
\bye
ZPL (Zebra Programming Language), 112 bytes
This is a just for fun answer.
^XA^FB137,4^FDHappy Birthday to You\&Happy Birthday to You\&Happy Birthday Dear ZPL\&Happy Birthday to You^FS^XZ
Explanation:
^XA # Start Format
^FB # Field Block
137, # Width of text block line (in dots)
4 # Maximum number of lines in text block
^FD # Field Data
Happy Birthday to You # Hardcoded String
\& # New Line (as allowed by the ^FB command)
Happy Birthday to You # Hardcoded String
\& # New Line (as allowed by the ^FB command)
Happy Birthday Dear ZPL # Hardcoded String
\& # New Line (as allowed by the ^FB command)
Happy Birthday to You # Hardcoded String
^FS # Field Separator
^XZ # End Format
Note: The Zebra Programming Language is a printer control language that is not Turing complete.
Vyxal, 26 bytes
`†‟ ¨ǎ`«∆Ẏ;↳«3ε2`βṄ ₴ŀ`Ṁẋ⁋
3ε # Three copies of
«∆Ẏ;↳« # Compressed string "to you"
2 Ṁ # Insert at index 2
`βṄ ₴ŀ` # Compressed string "dear Vyxal"
ẋ # and append, with a space, to
`†‟ ¨ǎ` # Compressed string "Happy birthday"
⁋ # Join the result by newlines
Vyxal 3, 35 bytes
"∦:'£⊣∧⊣ʀ∩Ϣ◌◲`④\②ᴥ~l≤bZ⎇yḧ”Ꮬbc(nsƵj
Vyxal's first commit was 5 years and 20 days ago, Happy belated birthday!
"b
b
cDear Vyxal,
bcHappy Birthday bcto You,"Ꮬbc(nsƵj
" " # regpacked target output (base-252 compressed in final solution)
Ꮬbc # literal string "bc", key for regpack decompression (chosen for high compressibility)
(nsƵj # regpack decompression routine:
(n # for each letter in the key
s # split main string by that
Ƶj # and join by last element
💎
Created with the help of Luminespire.
<script type="vyxal3">
"∦:'£⊣∧⊣ʀ∩Ϣ◌◲`④\②ᴥ~l≤bZ⎇yḧ”Ꮬbc(nsƵj
</script>
<script>
args=[]
</script>
<script src="https://themoonisacheese.github.io/snippeterpreter/snippet.js" type="module"/>
Setanta, 68 bytes
le i idir(-2,2)scriobh("Happy Birthday",(i&"to You")|"Dear Setanta")
Chicken, 20550 bytes
The language I chose is ridiculously unsuitable for code golfing, you will know why when you see the program.
However, there is an interesting feature in this language: chicken pushes the string chicken onto the stack, which is used in this program.
Of course, I didn't type the whole program. Instead, I used Python to generate most of the program in MiniChicken, then translate it into Chicken.
Try it online!, the MiniChicken code is used instead of the chicken code, because of its length.
///, 51 bytes
/@/Happy Birthday //#/to You
/
@#@#@Dear Slashes
@#
I'm back! Slashes is a great language for these very repetitive tasks.
Swift, 68 bytes
let t="to You"
[t,t,"Dear Swift",t].map{print("Happy Birthday "+$0)}
If you love Swift enough to let it compile a program without any unused result warnings for once (I know I do), then for 70 bytes:
let t="to You"
_=[t,t,"Dear Swift",t].map{print("Happy Birthday "+$0)}
Rust, 134 bytes
fn main(){let a=("Happy Birthday To you"," Dear Rust");for i in 1..3{println!("{}",a.0);}println!("{}{}",a.0,a.1);println!("{}",a.0);}
Ungolfed:
fn main(){
let a = ("Happy Birthday To you", " Dear Rust");
for i in 1..3{
println!("{}" ,a.0);
}
println!("{}{}" ,a.0, a.1);
println!("{}",a.0);
}
Windows Batch Scripting (88 bytes)
set "t=Happy Birthday to You"
set n=^&echo.
echo %t%%n%%t%%n%%t:to You=Dear Batch%%n%%t%
Japt -R, 37 36 bytes
4Æ`Happy Bir »y {XÍ?` Y `:`De Japt
-1 byte, thanks to Shaggy
Oliver's solution is very clever, this one is 2 bytes shorter but requires the R flag.
Explanation
4Æ Map each X in [0,4) to:
`Happy Bir »y { "Happy Birthday " with the following appended:
XÍ take 2 - X
?` Y ` nonzero -> "to You"
:`De Japt zero -> "Dear Japt"
R flag: output the result joined by newlines.
Uiua, 45 bytes SBCS
⍥(&p⊂"Happy Birthday ")4.,"Dear Uiua""to You"
Explanation
⍥(&p⊂"Happy Birthday ")4.,"Dear Uiua""to You"
"to You" # push string "to You" to stack
"Dead Uiua" # push string "Dear Uiua" to stack
, # duplicate 2nd-to-top stack element
. # duplicate top stack element
⍥( )4 # repeat this function 4 times:
"Happy Birthday " # push string "Happy Birthday " to stack
⊂ # join end-to-end
&p # print to stdout with newline
TypeScript's type system, 96 bytes
type F<A=`
Happy Birthday `,//@ts-ignore
B=`${A}to You`>=`${B}${B}${A}dear TypeScript Types${B}`
Try it at the TypeScript playground
Outputs with a leading newline.
Or, more elegantly but 3 bytes longer:
TypeScript's type system, 99 bytes
type Z<S="to You">=`Happy Birthday ${S&string}
`
type F=`${Z}${Z}${Z<"Dear TypeScript Types">}${Z}`
Try it at the TypeScript Playground
Outputs with a trailing newline.
Zsh, 51 bytes
set Happy\ Birthday to You
<<.
$@
$@
$1 Dear zsh
$@
Beats vanilla shell by one byte, despite having a one-byte longer name!
PowerShell, 66 bytes
I was determined to beat Dave Neeley's answer of 71 bytes
$h="Happy Birthday";($b="$h to You`r")*2;"$h Dear PowerShell`r";$b
Crayon, 48 46 bytes
"Happy Birthday to You
"4*q2Y15X"Dear¤Crayon"q
Explanation
Crayon's output is built on a 2-dimensional "canvas", which makes it ideal for ASCII art challenges. Text is drawn with a "crayon", which is a sort of cursor that moves around the canvas. Here's how this program works:
"Happy Birthday to You
" Push this string to the stack.
4* Repeat the string 4 times.
q Draw the string at the crayon (at (0,0) by default).
2Y15X Move the crayon to the "to" in the third line.
"Dear¤Crayon"q Push this string and draw it at the crayon.
Implicit: Output canvas
The ¤ represents byte \x1F; Crayon does not distinguish between the two. By default, a space does not overwrite the character underneath, so ¤ exists as a sort of "overwriting space".
beeswax, 66 chars
I created beeswax in December 2015. This solution is just for fun.
>`y Dear beeswax`5Np
pb"M`adhtriB yppaH`<3~4_
>`y To You`N~L;~ d
You can clone the beeswax interpreter, language specifications and instructions from my GitHub repository.
Golisp, 102 100 bytes
EDIT: Removed 2 bytes by changing the last writeln to write
write@*["Happy Birthday to You\n"2]writeln@"Happy Birthday Dear Golisp"write@"Happy Birthday to You"
Ungolfed & commented version:
write @ *["Happy Birthday to You\n" 2] # Call write with "Happy Birthday to You\n" repeated 2 times (f@x == f[x]) #
writeln @ "Happy Birthday Dear Golisp" # Write "Happy Birthday Dear Golisp" to stdout #
write @ "Happy Birthday to You" # Write "Happy Birthday to You" to stdout #
tinylisp, 120 114 bytes
(load library
(d x(q(Happy Birthday
(d y(join(concat x(q(to You)))spc
y
y
(join(concat x(q(Dear tinylisp)))spc
y
Python, 61 60 59
H="\nHappy Birthday to You"
print(H*3)[:60]+"Dear Python"+H
Quipu, 123 115 bytes
'H'D't[][][]
'a'e'o/\/\/\
'p'a' 2&1&2&
'p'r'Y[][][]
'y' 'o/\/\/\
' 'Q'u
'B'u\n
'i'i/\
'r'p
't'u
'h\n
'd
'a
'y
'
/\
Explanation
Each pair of columns in a Quipu program is a "thread." Execution proceeds from the top of each thread to the bottom, left to right from one thread to the next. Each thread also stores a value, which can be referenced by other threads.
- Thread 0 outputs
Happy Birthdaywith a trailing space and sets its value to that string. - Thread 1 sets its value to
Dear Quipuwith a trailing newline. - Thread 2 outputs
to Youwith a trailing newline and sets its value to that string. - Thread 3 outputs the value of thread 0, then outputs the value of thread 2.
- Thread 4 outputs the value of thread 0, then outputs the value of thread 1.
- Thread 5 outputs the value of thread 0, then outputs the value of thread 2.
Barrel, 112 bytes
All this jumping eats up the bytes, I'm afraid.
→1→2→3→1→2→3→1→4→3→1→2'!'!¤'Happy birthday'↑¤' to you'↑¤','¶↑¤', dear Barrel'↑
Basically, it defines a bunch of functions whose purpose is to implicitly print strings and calls them in the appropriate order before exiting. The second ! (the first one is a string for ending the song) exits the program so that barrel doesn't continue executing the program. If the ! were not there, barrel would implicitly print 'Happy birthday' and then exit, seeing that the ↑ instruction doesn't have any more location pointers to pop, and therefore "pops" to the program that ran barrel.
AWK, 70 64 bytes
BEGIN{for(;++x<5;)print"Happy Birthday",x~3?"Dear AWK":"to You"}
Thanks for the suggestion @PedroMaimere :)
Deadfish~, 680 bytes
{i}ds{d}ic{ii}iiiiic{i}iiiiicc{i}dc{{d}i}ic{{i}ddd}ddddc{i}dddc{i}dciic{d}ddcddddcdddc{ii}iiiic{{d}i}ic{{i}dd}iiiicdddddc{{d}ii}ic{{i}d}dc{d}ciiiiiic{{d}d}iiic{iiiiii}iic{ii}iiiiic{i}iiiiicc{i}dc{{d}i}ic{{i}ddd}ddddc{i}dddc{i}dciic{d}ddcddddcdddc{ii}iiiic{{d}i}ic{{i}dd}iiiicdddddc{{d}ii}ic{{i}d}dc{d}ciiiiiic{{d}d}iiic{iiiiii}iic{ii}iiiiic{i}iiiiicc{i}dc{{d}i}ic{{i}ddd}ddddc{i}dddc{i}dciic{d}ddcddddcdddc{ii}iiiic{{d}i}ic{iiii}ddddc{iii}iiicddddc{ii}dddc{{d}ii}ddc{iiii}ddddc{iii}iiicddddciiiciiciiic{i}c{d}dc{ii}iic{{d}dd}iiiic{iiiiii}iic{ii}iiiiic{i}iiiiicc{i}dc{{d}i}ic{{i}ddd}ddddc{i}dddc{i}dciic{d}ddcddddcdddc{ii}iiiic{{d}i}ic{{i}dd}iiiicdddddc{{d}ii}ic{{i}d}dc{d}ciiiiiic
-18 thanks to @astonearachnid
BRASCA, 72 67 bytes
I really should add string compression...
l`uoY ot yadhtrib yppaH`58S[$:om{]xl`ACSARB raeD `L[$o{]x8p21S[$o{]
Explanation
l`uoY ot yadhtrib yppaH` - Push "Happy birthday to You\n"
58S[$:om{]x - Output it twice followed by "Happy birthday"
l`ACSARB raeD ` - Push " Dear BRASCA\n"
L[$o{]x - Output it
8p - Shift the stack so the top is "Happy birthday to You"
21S[$o{] - Output that.
Branch, 145 bytes
72/97Q/112/;/121N/32O/66/105/114P/116R/104T/100/q/n/oa[./]a\Br/111S/o/89/s/117/10b[./]a[./]b[./]a[./]b\68.101.q.p.o.66.p.q.110.99.t.10.a[./]b[./]
Try it on the online Branch interpreter!
Duocentehexaquinquagesimal, 433 211 bytes
-222 thanks to ovs.
3∞н5Ćf–γúpïJ₂BΛ™H&¬¡ÌÿD"çÑ^oºvÄv»Ö{ž£&B#žà₆?àë”%₄J€Ba{‹Ƶiê)Jkí:¼Ω3ÃzjWÝ„|†rвávĀÜΛ°λöyÅÍ`mΣ×>K$λÜ—∍¯zÏΔ!#äy½´`в²!ÚÉ¡]5мô₃^Íp÷‰Ê)ûEîTº8E&sÙγüíθ4®₄ñтšиćÙA4ºÚIÜζ∍õ+¦ôι«$ι<yf·¶ê‹žƵ=v™>jg¥¢¦ŽнhΔÐŽÎΩć7∞ñè₄ćD祃¨=ŽαxO,š
Try it online! This answer was posted on the same day that I created Duocentehexaquinquagesimal. Happy birthday!
Sandwich, 64 bytes
lhHappy Birthday
lt$h to you
ld$h dear sandwich
p$t
p$t
p$d
p$t
Bit of a naive approach, but it works.
Explanation: Sandwich is comprised of opcodes. The first letter of each line is the opcode, and the rest of the characters of the line are the arguments that are passed to the opcode.
Above code with comments:
lhHappy Birthday # Create variable h and assign "Happy Birthday"
lt$h to you # Create variable t and assign "$h to you", which resolves to Happy Birthday to you
ld$h dear sandwich # Create variable d and assign "$h dear sandwich", which resolves to Happy Birthday dear sandwich
p$t # print out variable t
p$t
p$d # print out variable d
p$t
JavaScript (Node.js), 79 bytes
for(i=0;++i<5;)console.log(`Happy Birthday ${i==3?'Dear JavaScript':'to You'}`)
naz, 210 bytes
1x1f0m9a8m1o9a9a7a1o9a6a2o9a1o4d2a1o2d4m2a1o5d8m1a1o9a1o2a1o9s3s1o4s1o3s1o9a9a6a1o4d2a1o0x1x2f2d7m4a1o5s1o3d5s1o3m7s1o3d4m5s1o6a1o9d3s1o0x1f2f1f2f1f2m4a1o3d5m9s1o4s1o9a8a1o3d6s1o3m9a5a1o9s4s1o9a9a7a1o9d3s1o1f2f
I haven't had much time for code golf lately, but I had to get this challenge knocked out: at the time of writing, naz's GitHub repo was created exactly 1 year and a few minutes ago. Happy birthday, my child.
Output includes an extra trailing newline.
Explanation (with 0x commands removed)
# Function 1
# Output "Happy Birthday "
1x1f0m9a8m1o9a9a7a1o9a6a2o9a1o4d2a1o2d4m2a1o5d8m1a1o9a1o2a1o9s3s1o4s1o3s1o9a9a6a1o4d2a1o
# Function 2
# Output "to You\n"
1x2f2d7m4a1o5s1o3d5s1o3m7s1o3d4m5s1o6a1o9d3s1o
1f2f1f2f1f # Output the first 2.5 lines
2m4a1o3d5m9s1o4s1o9a8a1o3d6s1o3m9a5a1o9s4s1o9a9a7a1o9d3s1o # Output "Dear naz\n"
1f2f # Output the last line
05AB1E, 39 bytes
”ŽØ¢© ”“€„ “«”€î”«U,,”ŽØ¢©¬Ž 05AB1E”,X,
”ŽØ¢© ”“€„ “«”€î”« # push "Happy Birthday to You"
U # store top of stack in variable X
,, # output top of stack twice
”ŽØ¢©¬Ž 05AB1E” # push "Happy Birthday Dear 05AB1E"
, # output top of stack
X, # output X
Scala, 89 bytes (also it is not my favourite)
(1 to 4).map{i=>"Happy Birthday "+(if(i==3)"dear SCALA" else "to You")}.foreach{println}
Maybe it could be less, it is just a default example, so feel free to improve.
Regarding Java:
If ignoring the excess stuff it is also possible to do a "import static java.lang.System.*;" and then use out.println. So something like this is possible (87 chars):
int i=0;while(i<=3){out.println("Happy Birthday "+((i==2)?"dear Java":"to you"));i++;}
(also it is longer than the solution from Stretch Maniac - see https://codegolf.stackexchange.com/a/39768)
International Phonetic Esoteric Language (IPEL), 96 or 60 bytes
I call this language both "International Phonetic Esoteric Language" and "IPEL". So, 2 answers:
"Happy Birthday ""to You"dbudbodbudbodbud"Dear International Phonetic Esoteric Language"odbudbod
"Happy Birthday ""to You"dbudbodbudbodbud"Dear IPEL"odbudbod
Explanation
"Happy Birthday ""to You"dbudbodbudbodbud"Dear IPEL"odbudbod
"Happy Birthday ""to You" (push strings)
dbudbodbudbo (print "Happy Birthday to You" twice)
dbud"Dear IPEL"o (print "Happy Birthday to [lang]")
dbudbod (one more "Happy Birthday to You")
W d, 34 bytes
Short language name to the rescue!
W is just 0.0833 years old but I'm still posting this ... Insanely long but oh well.
♣∙♥ª¬^╗Γë├ΦñtQOi▼!◙╖☼▓Φ◙ï╔♀EÞr!R╫J
Explanation
4 E % Foreach in the range from 1 to 4:
"Happy Birthday " % Append the string "Happy Birthday "
a3= % If this is the third line:
"Dear W"& % Output "Dear W"
"to You"| % Otherwise, output "to You"
+ % Join the two strings.
% Output a newline.
JavaScript (84 76 bytes)
x=`Happy Birthday To You\n`,alert(x+x+`Happy birthday Dear JavaScript\n`+x)
Output:
Happy Birthday To You
Happy Birthday To You
Happy Birthday Dear JavaScript
Happy Birthday To You
Wren, 78 bytes
I have forgotten about Wren so I'm trying to use it.
Fn.new{(1..4).map{|i|"Happy Birthday "+(i==3?"Dear Wren":"to You")}.join("
")}
GolfScript, 49 bytes
Just a blatant port of the CJam answer.
"Happy Birthday to You
"...15<"Dear GolfScript
"@
Stax, 28 bytes
▄Jÿø•2╜x!╨¬r├^↑#8╕Γ☺°7¿5⌠☻U▄
Run and debug it at staxlang.xyz!
I'm two weeks late. Alas. But it's short, at least...
Unpacked (34 bytes) and explanation:
`/&tpz/b}"=J:J=P*``!0 ZrO"`n)ncLmT
`/&tpz/b}"=J:J=P*` Literal "Happy Birthday to You "
`!0 ZrO"` Literal "Dear Stax"
n Copy the first line to the top of the stack
) Overwrite end with "Dear Stax"
nc Copy the first line twice more to the top
L Collect stack in a list
mT Print each, trimmed of trailing spaces, on its own line
If you're fine with those three trailing spaces, drop the T for 33 bytes unpacked. Still 28 packed, unfortunately.
Keg, 74 bytes
(2|Happy Birthday to You\
)
Happy Birthday Dear Keg\
Happy Birthday to You
05AB1E, 29 bytes
”to€î”Д¬Ž 05AB1E”s)”ŽØ¢© ”ì»
”to€î” # dictionary string "to You"
Ð # triplicate
”¬Ž 05AB1E” # dictionary string "Dear 05AB1E"
s # swap
) # wrap entire stack in an array
”ŽØ¢© ” # dictionary string "Happy Birthday "
ì # prepend to each string in the array
» # join array by newlines
Gol><>, 55 bytes
a"Happy birthday to you"3F6sK|6sR}a"Dear Gol><>"6sR{r~H
Voila, explanation coming soon!
T-SQL, 89 87 bytes
Edit: Probably shouldn't be dredging these old things up, but I just noticed an obvious change to this to reclaim a couple of bytes.
Using STUFF to remove unwanted parts of the string, the starting index is provided by the values in the FROM clause multiplied by 3
SELECT STUFF('Happy Birthday to You Dear SQL',N,8,'')FROM(VALUES(24),(24),(15),(24))S(N)
Excel VBA, 687 686 686 681 Bytes
From the problem statement:
However, I'm also rewarding other witty submissions with up-votes (and I encourage everybody to do so as well). Therefore although this is a code-golf contest, not-so-short answers are also welcome.
Code
Full subroutine that takes no input and outputs a happy birthday song for VBA onto the range [A1:CM23] of the ActiveSheet object.
Global l
Sub a
Cells.RowHeight=48
For l=0To 3
p[A1:A5,B3,C1:C5,F1,E2:E5,G2:G5,F3,I1:I5,J1,K2,J3,M1:M5,N1,O2,N3,Q1:Q2,R3:R5,S1:S2]
p[Y1:Y5,Z1,AA2,Z3,AA4,Z5,AC1:AE1,AD2:AD4,AC5:AE5,AG1:AG5,AH1,AI2,AH3,AI4:AI5,AK1:AM1,AL2:Al5,AO1:AO5,AP3,AQ1:AQ5,AS1:AS5,AT1,AU2:AU4,AT5,AX1,AW2:AW5,AY2:AY5,AX3,BA1:BA2,BB3:BB5,BC1:BC2]
If l-2Then p[BI1:BK1,BJ2:BJ5,BN1,BM2:BM4,BN5,BO2:BO4,BU1:BU2,BV3:BV5,BW1:BW2,BZ1,BY2:BY4,BZ5,CA2:CA4,CC1:CC4,CD5,CE1:CE5]Else p[BI1:BI5,BJ1,BK2:BK4,BJ5,BM1:BM5,BN1:BO1,BN3,BN5:BO5,BR1,BQ2:BQ5,BS2:BS5,BR3,BU1:BU5,BV1,BW2,BV3,BW4:BW5,CC1:CC4,CD5,CE1:CE4,CG1:CG5,CH1,CI2,CH3,CI4,CH5,CL1,CK2:CK5,CM2:CM5,CL3]
Next
End Sub
Sub p(r)
r.Offset(6*l).Interior.Color=0
End Sub
Output
C (gcc) and aplay, 360, 175, 167, 151 bytes
Generates the contents of a WAV file onto stdout, singing the melody of Happy Birthday. The output can then be piped to, for example, aplay to listen to it.
Including -lm causes a +4 to score.
Also, thanks to ceilingcat for golfing a couple dozen bytes.
c,i;main(t,T){for(;i<25;i++)for(t=T="$$(((0$$(((0$$((((($$(((0"[i]-32<<9;t--;)putchar(c=sin(exp("!!#!&%!!#!(&!!-*&%#++*&(&"[i]/17.-2)*t)*9*t/T+9);}
Try it online! (won't produce sound, duh...)
Now available on Clyp for listening. Amplified for convenience, may be loud and/or pop on some devices.
Try it offline!
Compile and listen with gcc -w src.c -lm && ./a.out | aplay
Degolf
c,i;
main(t,T) {
for(;i<25;i++) // 25 notes of the song in the loop, 25 notes of the song
for(t=T="$$(((0$$(((0$$((((($$(((0"[i]-32<<9; // Select number of samples
t--;)
// See below, this has been mutilated quite a bit to golf it.
// Assign to c for implicit cast to int.
// A small shortcut is made by only dampening the sine-part of the wave.
putchar(c=sin(exp("!!#!&%!!#!(&!!-*&%#++*&(&"[i]/17.-2)*t)*9*t/T+9);
}
A sine wave is defined as \$s(t)=A\cdot\sin 2\pi t\$. A sine wave with frequency \$f\$ can thus be expressed as \$s(ft)\$. Now, in this case \$\{t\in\mathbb N \mid0\leq t \leq T \}\$ and \$T:=n\cdot2^{11}\$, so we have to divide \$t\$ with 2048, in order to make the signal function work. Our function is now \$s(2^{-11}\cdot ft)\$.
Since listing the frequencies would take a significant amount of bytes, I have encoded the frequencies as halfsteps relative to A4, represented by 40 or ( in the string. The frequency is thus obtained \$f=440Hz \cdot 2^{c-40\over12}\$. Finally, putting it all together, adding in some dampening and ensuring outputs greater than zero, we get:
$$ f(t)= \Bigg({T - t\over T}\Bigg) \Bigg({A\over2}+{A\over2}\sin \Big({880 \pi t \cdot 2^{c-40\over12}\cdot2^{-11}} \Big)\Bigg) $$
$$ f(t)= \Bigg({T - t\over T}\Bigg) \Bigg({A\over2}+{A\over2}\sin \Big({880 \pi t \cdot \exp\Big({{c\ln 2-40\ln 2\over12} - 11 \ln 2}}\Big) \Big)\Bigg) $$
$$ f(t)= \Bigg({T - t\over T}\Bigg) \Bigg({A\over2}+{A\over2}\sin \Big({ t \cdot \exp\Big({{c\ln 2-40\ln 2\over12} - 11 \ln 2 + \ln 880 \pi}}\Big) \Big)\Bigg) $$
$$ f(t)\approx \Bigg({T - t\over T}\Bigg) \Bigg({A\over2}+{A\over2}\sin \Big({t \cdot \exp \Big({c\over17}-2\Big)} \Big)\Bigg) $$
And finally, we select \${A\over2}=9\$ to conserve bytes.
Cubically, 251 bytes
⇒:4+@:5+2/1+55@+2S-0@@S'+1@f2/1+52@F+5@F'+1@:4/1+6255@U-1@U'/6+1*@S-0@S'+1/1*@f2
⇒:5/1+3@
⇒/6+6366@/4+552@f2/67+55@/3+552@B+1@B'/6+1@
f1f3f1f3f1//3+6635@/3+551@:5+2/1+55@/3+6552@f2+/3+165@-6+355@/6++++55@/3+6551@:1+55@:5+2/1+55@:2+55@@/6+61*@/6+1@f1f3
Explanation:
First, second and third lines are functions.
First line prints "Happy Birthday " (note the trailing space)
Second line prints a space (to golf it down)
Third line prints "to You\n"
Fourth line is the program. It simply calls functions and prints "Dear Cubically\n" on the third line.
A0A0 - 309 bytes
A0A0
A0C3G1G1G1G1G1G1G1G1G1G1G1G1G1G1G1A0
A0P72P97P112P112P121P32P66P105P114P116P104P100P97P121P32G3A0
A0A1G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3A0
G-3
G1G4G7G4
A0A0
A0C3G1G1G1G1G1G1G1A0
A0P116P111P32P89P111P117P10G3A0
A0A1G-3G-3G-3G-3G-3G-3G-3A0
G-3
G-8G-8
P68P65
P101P48
P97P65
P114P48
P32P10
G-5G-14
Explanation:
A0A0
A0C3G1G1G1G1G1G1G1G1G1G1G1G1G1G1G1A0
A0P72P97P112P112P121P32P66P105P114P116P104P100P97P121P32G3A0
A0A1G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3A0
G-3
Creates a loop which prints "Happy Birthday " and jumps every iteration.
G1G4G7G4
The positions the code should jump to each iteration.
A0A0
A0C3G1G1G1G1G1G1G1A0
A0P116P111P32P89P111P117P10G3A0
A0A1G-3G-3G-3G-3G-3G-3G-3A0
G-3
Creates a loop which will print "to you" and jumps out of the loop after each iteration.
G-8G-8
More positions to jump to, but this time for the second loop (also acts as a sort of counter, adding an additional G-8 would print "Happy Birthday " one more time).
P68P65
P101P48
P97P65
P114P48
P32P10
G-5G-14
Prints "Dear A0A0" and jumps back to the first loop.
MBASIC, 93 bytes
1 FOR I=1 TO 4:PRINT"Happy Birthday ";:IF I=3 THEN PRINT"Dear MBASIC"ELSE PRINT"to You"
2 NEXT
brainfuck, 377 bytes
--->-->->>>>>->->>>>>>>>->-->>>->>>>-->->>>>->>>>>>>>>>+[-[>+++++++<-]<+++]>---->+>++>->+>+>++>--->++>>+>++>>->->++>--->->++>+>--->-->+>++>->++>>->+>--->->+>->>+>>++>->>++++[----[>+++++++<-]<++++]>---->--->+++>>+>+>+++>-->--->+>+++>-->>+++>>+++>-->+>-->>-->->>->+>->--->>+++>-->+>+++>>+>->-->->++>+++>--[++<++++]>>[.>]>[.>]<<[<<]>[.>]>[.>]<<[<<]>[.>]>[>]>[.>]<[[<]<]>>[.>]>[.>]
Most of the code sets up "\nHappy Birthday \0to You\0Dear brainfuck". The last 64 instructions print it.
Pyth - 42 40 bytes
J." y-÷\n3ª¼öj"K+J"to you"KK+J"dear Pyth"K
J." y-÷\n3ª¼öj" Assign J to "Happy Birthday "
K+J"To you" Assign K to J + "to you"
KK Print K twice
+J"dear Pyth" Print J+"dear Pyth"
K Print K
Charcoal, 56 bytes
≔Happy Birthdayη≔ to YouτP⁺ητ↓P⁺ητ↓P⁺η”↶ G↗5▶h…≡-⌕”↓P⁺ητ
Try it online! (Link to the verbose version.)
It wasn't fair that Charcoal still hadn't its own birthday party...
Whitespace, 373 bytes
[N
S T S
N_Call_Label_to_You\n][N
S T
N_Call_Label_Happy_Birthday_][S S T T S T T T S S N
_Push_-92_newline][S S T T N
_Push_-1_e][S S T T T N
_Push_-3_c][S S T T S T N
_Push_-5_a][S S S T S T S N
_Push_10_p][S S S T T S T N
_Push_13_s][S S T T N
_Push_-1_e][S S S T T T S N
_Push_14_t][S S S T T N
_Push_3_i][S S S T S N
_Push_2_h][S S T T T T T N
_Push_-15_W][S S T T S S S T T S N
_Push_-70_space][S S S T T S S N
_Push_12_r][S S T T S T N
_Push_-5_a][S S T T N
_Push_-1_e][S S T T S S S T S N
_Push_-34_D][N
S T
N_Call_Label_Happy_Birthday_][N
S T S
N_Call_Label_to_You\n][N
S T
N_Call_Label_Happy_Birthday_][N
S T S
N_Call_Label_to_You\n][N
S T
N_Call_Label_Happy_Birthday_][N
S S T N
_Create_Label_LOOP][S S S T T S S T T S N
_Push_102][T S S S _Add][T N
S S _Print_as_character][N
S N
T N
_Jump_to_Label_LOOP][N
S S N
_Create_Label_Happy_Birthday_][S S T T S S S T T S N
_Push_-70_space][S S S T S S T T N
_Push_19_y][S S T T S T N
_Push_-5_a][S S T T S N
_Push_-2_d][S S S T S N
_Push_2_h][S S S T T T S N
_Push_14_t][S S S T T S S N
_Push_12_r][S S S T T N
_Push_3_i][S S T T S S T S S N
_Push_-36_B][S S T T S S S T T S N
_Push_-70_space][S S S T S S T T N
_Push_19_y][S S S T S T S N
_Push_10_p][S N
S _Duplicate_top][S S T T S T N
_Push_-5_a][S S T T T T T S N
_Push_-30_H][N
T N
_Return][N
S S S N
_Create_Label_to_You\n][S S T T S T T T S S N
_Push_-92_newline][S S S T T T T N
_Push_15_u][S S S T S S T N
_Push_9_o][S S T T T S T N
_Push_-13_Y][S S T T S S S T T S N
_Push_-70_space][S T S S T S N
_Copy_2nd_o][S S S T T T S N
_Push_14_t][N
T N
_Return]
Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.
Explanation in pseudo-code:
Call function to_You\n
Call function Happy_Birthday_
Push values for "\necapsetihW raeD" (reversed of "Dear Whitespace\n") to the stack
Call function Happy_Birthday_
Call function to_You\n
Call function Happy_Birthday_
Call function to_You\n
Call function Happy_Birthday_
Start LOOP:
Integer i = top value of the stack
i = i + 102
Print i as character to STDOUT
Go to next iteration of LOOP
function Happy_Birthday_:
Push values for " yadhtriB yppaH" (reversed of "Happy Birthday ") to the stack
Return
function to_You\n:
Push values for "\nuoY ot" (reversed of "to You\n") to the stack
Return
Constant 102 was generated with this Java program, and used with this Whitespace tip of mine to print the text by putting the values reversed to the stack, and looping over them (adding the contant value, and printing them as character to the stack; which also exits as soon as we don't have any more values on the stack).
In addition, the functions with return are used to prevent duplicated code for the repeated parts of the output-text. And there were two more things to golf:
- The value for the second
pin"Happy"(which wasSSSTSTSN- push 10) has been replaced withSNS(duplicate top). - The value for the second
oin"to You"(which wasSSSTSSTN- push 9) has been replaced withSTSSTSN(copy 2nd [1-indexed]). (Relevant Whitespace tip of mine.)
Python 3, 74 bytes i know it's too much
b="Happy Birthday to You\n"
print(b+b+b.replace("to You","Dear Python")+b)
C\C++ Preprocessor, 244 224 bytes
#define A "to"
#define B "You"
#define C "C"
#ifdef __cplusplus
#define C "C++"
#endif
#define D "Dear"
#define E "Happy Birthday"
#define H printf("%s %s %s \n",E,A,B)
int main(){H;H;printf("%s %s %s \n",E,D,C);H;return 0;}
jamal, 57 characters
{@for _(///dear jamal/0)Happy Birthday {@if/_/_/to You}
}
Sample run:
bash-4.4$ jamal.pl birthday.jam
Happy Birthday to You
Happy Birthday to You
Happy Birthday dear jamal
Happy Birthday to You
Stax, 30 bytes
ï■σ∞úφ♂mê▌δ↓T┌C▒7w↓√éº┌│╦╫C∩█ï
Explanation
Uses ASCII representation to explain:
`=%5#`GG`!0 ZrO"`GdG}`I#aq5J^oD}(`pQ
} Define a subroutine after the bracket
`I#aq5J^oD}(` Push "Happy Birthday "
p Pop the string and print without newline
Q Peek the stack and print with newline
`=%5#` Push "to You"
GG Call the subroutine twice
`!0 ZrO"` Push "Dear Stax"
G Call the subroutine
d Pop and discard "Dear Stax"
G Call the subroutine again
Attache, 54 bytes
Print=>4&("Happy Birthday "+2&"To You"'"Dear Attache")
Explanation
2&"To You"'"Dear Attache"
2&"To You" resizes "To You" into a 2-length array
'"Dear Attache" concatenate with "Dear Attache"
result: ["To You", "To You", "Dear Attache"]
"Happy Birthday "+_ Adds this string to each element
result: ["Happy Birthday To You", "Happy Birthday To You", "Happy Birthday Dear Attache"]
4&(_) Resizes the array to size 4
result: ["Happy Birthday To You", "Happy Birthday To You", "Happy Birthday Dear Attache", "Happy Birthday To You"]
Print=>_ Prints each member on its own line
Aceto, 57+1 for -l flag = 58 bytes
"Happy Birthday "ddd"to you"ddQJpnQJpn"Dear Aceto"QJpnsJp
"Happy Birthday " push that string
ddd duplicate three times
"to you" push that string
dd duplicate twice
Q Pull from bottom of stack
Jpn Join, print, & newline
QJpn pull from bottom, &Join,print&\n
"Dear Aceto" push that string
QJpn Pull,Join,print,\n
sJp swap, Join, and print
Python 2, 82 Bytes
h="Happy Birthday";y='to You';d="Dear Python";print h,y,'\n',h,y,'\n',h,d,'\n',h,y
Still getting my head around slicing...
C++, 135 bytes
Great thanks to Steadybox and DJMcMayhem for shortening this code by 55 characters! :)
#include<iostream>
#include<string>
std::string s="Happy Birthday ",t="to you\n",u="Dear C++\n";int main(){std::cout<<s+t+s+t+s+u+s+t;}
Canvas, 43 bytes
3[to You¶}Dear Canvas¶)«∑Happy Birthday 4*×
With notes (not valid code, as Canvas does not support comments):
3[to You¶} Push the string "to You\n" to the stack three times
Dear Canvas¶ Push the string "Dear Canvas\n" to the stack
) Compress the stack to an array
« Shift the array once to the left
∑ Join all strings in the array to one string
Happy Birthday 4* Push the string "Happy Birthday " repeated four times vertically to the stack
× Concatenate the second object in the stack to the first object in the stack
Print the object at the top of the stack (implicit)
REXX: 73 bytes
n='Happy Birthday to You'
m='Happy Birthday Dear REXX'
say n
say n
say m
say n
SAY echoes the data and the output is
Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear REXX
Happy Birthday to You
Java, 127 125 bytes
class h{public static void main(String[]a){String b="\nHappy Birthday ",d=b+"to You";System.out.print(d+d+b+"Dear Java"+d);}}
However, if you ignore all of the excess stuff, it is only 82 80 bytes:
String b="\nHappy Birthday ",d=b+"to You";System.out.print(d+d+b+"Dear Java"+d);
Oh, and it starts with a newline, saving 2 bytes.
Sed, 60 55 bytes
(1 character added because there is no way to make sed to work without input.)
s/^/Happy Birthday To You/
h
G
G
G
s/To You/Dear sed/3
Certainly not a winner, posted to demonstrate sed's rare s/// feature of replacing just the nth occurrence.
bash-4.3$ sed 's/^/Happy Birthday To You/;h;G;G;G;s/To You/Dear sed/3' <<< ''
Happy Birthday To You
Happy Birthday To You
Happy Birthday Dear sed
Happy Birthday To You
Sed (shorter but not interesting): 52 characters
s/^/Happy Birthday To You/
h
G
p
s/To You/Dear sed/
Sample run:
bash-4.3$ sed 's/^/Happy Birthday To You/;h;G;p;s/To You/Dear sed/' <<< ''
Happy Birthday To You
Happy Birthday To You
Happy Birthday Dear sed
Happy Birthday To You
Golfscript, 56 bytes
Thanks, professorfish!
"Happy Birthday ":h"to You\n"+:s s h"dear Golfscript\n"s
Output:
Happy Birthday to You
Happy Birthday to You
Happy Birthday dear Golfscript
Happy Birthday to You
T-SQL, 78 bytes
SELECT a+b+a+b+a+c+a+b
FROM(SELECT'Happy Birthday 'a,'to You
'b,'Dear SQL
'c)t
SQL strings can include line breaks. If you are using SSMS, make sure to use "Results to Text" instead of "Results to Grid"
I used a different technique than the two excellent SQL answers already here:
If a leading newline is allowed (not mentioned in the rules or addressed in the comments), I can save one byte by moving the line break to the beginning of the 'Happy Birthday' string.:
SELECT a+b+a+b+a+c+a+b
FROM(SELECT'
Happy Birthday 'a,'to You'b,'Dear SQL'c)t
Unary, 2.715E2345 bytes
A string of zeroes with a length of 271544303753521374345784023617462447448766796991634195623271771343788064494033932467809637777433783261069835136468316635541569006957484008922172956907493623220358279584621153727394685316177875072717611870164011317998138133192412590581118711745080372132354520144049887264020357596958970682508119612069072184789433001139110110044141818883356102010044766108874743534376722033752443907309500308124800880956659496453762860029730933467190897780852535562502370486347488149358821225254933647032473098015846900520720300239993510123716590092279978630211422199772105659685365124211730629429856761187973769267382198582572968422104301126603859498501185917608874757741610893482041977003001381483481251619529628722427408338582339527157335234122942381275923949390605570564504822082772136057434464671123507495503027121245882553216512907124492451345153924551954324886539679044057026572440371334484657248811556813671966134409423451672608237773610848374597757496223902091127753821502096156978576733667670645804932685651998882744625271805968408192138003017383834286411465787825657955474390895833048578431020834761999769245058175985114327604667460675218915598066545717356728963407131382225834981689192053204022543453105950548359569307644293248265610511261123308873236361708287888512920927207140733264710153499926338085521461180344119631268486929440101264937117199882754841067458895376078972797675755102211602033168204711199744629239139853151734765325982327999734282103666604630769384354544377780974557091020653916122475973344426958326542939871981389127350485205414017350058299535652163085166091203298279054857159449355550278205308529995426116266317622349698148579685752377806473014344962213328458584663395562552762790574493037199848761427965675120816268240569132735553272845975553355819867289784427736974879735152861965319683108949477353673024614920892135291073944764379263817004591234093204928220689300382675729272978243082941205866127086587758323575891345926945843642967213885479373059430434109978135813970824413339027287055293233734939242557385167820253321966087885920624040254325137166864535273452145628538868866835395916784107310616214635120965693431403440614294637759561044455445706647271846433473546725069631283599186867863795122114084809385455487348989575611753135663244291563170055464760084089978670081473032469603515349502029160880861825869931824089974215244
Pyth, 49 bytes
Since the other Pyth answer is quite outdated and non-competing has been removed per meta consensus, here is a newer answer:
K"Happy Birthday "J+K"to You\n"+*J2+K"Dear Pyth"J
Pyth, 50 bytes
K+"Happy Birthday to You"b+++KK++<K15"Dear Pyth"bK
Cubically, 813 bytes
I guess this belongs here now too! Loops haven't been added to the language yet, so this is the best I can manage.
+53@6:5+2/1+55@6:4/1+552@66+1@6:5/1+3@6/1+52@6:5+1/1+551@6+1@6:5+3/1+552@6:5/1+551@6:1/1+551@6:5+2/1+55@6:4/1+553@6:5/1+3@6:5+3/1+552@6:3/1+552@6:5/1+3@6:5+3/1+54@6:3/1+552@6:5+53@6:1/1+1@6:5+3@6:5+2/1+55@6:4/1+552@66+1@6:5/1+3@6/1+52@6:5+1/1+551@6+1@6:5+3/1+552@6:5/1+551@6:1/1+551@6:5+2/1+55@6:4/1+553@6:5/1+3@6:5+3/1+552@6:3/1+552@6:5/1+3@6:5+3/1+54@6:3/1+552@6:5+53@6:1/1+1@6:5+3@6:5+2/1+55@6:4/1+552@66+1@6:5/1+3@6/1+52@6:5+1/1+551@6+1@6:5+3/1+552@6:5/1+551@6:1/1+551@6:5+2/1+55@6:4/1+553@6:5/1+3@6+4@6:2/1+551@6:5+2/1+55@6:5+1/1+552@6:5/1+3@6:4/1+52@6:5+53@6:5+3/1+55@6:5+1/1+551@6:5+51@6:5+2/1+55@6:5+52@66:4/1+553@6:1/1+1@6:5+3@6:5+2/1+55@6:4/1+552@66+1@6:5/1+3@6/1+52@6:5+1/1+551@6+1@6:5+3/1+552@6:5/1+551@6:1/1+551@6:5+2/1+55@6:4/1+553@6:5/1+3@6:5+3/1+552@6:3/1+552@6:5/1+3@6:5+3/1+54@6:3/1+552@6:5+53@6
VBA, 58 Bytes
Anonymous VBE immediate window function that takes no input and makes VBA sing its own happy birthday song, alone.
h="Happy Birthday ":t="to You":?h;t:?h;t:?h"Dear VBA":?h;t
IDL (Interactive Data Language) – 47
Late entry (my first time here), but this looks like 3rd place after CJam and J!
Using IDL's Implied Print feature (since version 8.3), typing this at the command prompt:
'Happy Birthday '+[(u='to You'),u,'Dear IDL',u]
… will print the desired result to the console:
IDL> 'Happy Birthday '+[(u='to You'),u,'Dear IDL',u]
Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear IDL
Happy Birthday to You
It works by creating (and implicitly printing) a four-element array, with 'Happy Birthday ' appended to each of the four desired endings, made more concise/cryptic by assigning a variable u the value 'to You' in the first instance, and reusing it twice later!
Braingolf, 69 bytes
"Happy Birthday to You
"VR{.M}v&,6>[$_]"dear Braingolf
"R!&@!&@v&@c&@
Explanation
"Happy Birthday to You
"
Pushes "Happy Birthday to You\n" to the stack
VR{.M}
Creates a 2nd stack and duplicates the contents of the first stack to it, in reverse order
v&,
Switches to the 2nd stack and flips the entire stack
6>[$_]
Drops the last 7 items from the 2nd stack
"dear Braingolf
"
Pushes "dear Braingolf\n" to the 2nd stack
R!&@!&@
Prints the contents of the first stack twice
v&@
Prints the contents of the 2nd stack
c&@
Prints the contents of the first stack
Minecraft, 120 bytes
tellraw @a {"text":"Happy Birthday to You\nHappy Birthday to You\nHappy Birthday Dear Minecraft\nHappy Birthday to You"}
Can be run by pasting into a command block and supplying power to it, or pasting into the chat with a slash at the start.
;#, 11644 bytes
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#
Code generated by this brainfuck program
Fourier, 52 bytes
|`Happy Birthday `|A|`to You
`|BABABA`Dear Fourier
`AB
Nothing particularly special except that it demonstrates that you can have newlines in string prints.
Python 507 bytes
print """
H a p py- Bir t h day -to-Y ou= Happy - B irt h d a y
- t o - Y o u = H a p p y - B i r t h d a y - D e
ar-P ython =Ha ppy - Bir t hda y -to- Y o uHapp y -
B i r t h d a y - t o - Y o u = H a p p
y - B i r t h day -to-Y o u = H a ppy - B i r
""".replace("\n","").replace(" ","").replace("-"," ").replace("=","\n")[:92]
Not winning any prizes ... but if you look at it carefully, there is some ASCII art:
# # # ### ### # # ### ##### ### ##### # # ### # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #### ##### ### ### # ### # ### # #### # # ##### # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ### ##### # # # # # ### # # # #
Common LISP, 169 bytes
(defun birthday ()
(princ "Happy Birthday to You")
(princ "Happy Birthday to You")
(princ "Happy Birthday dear Common LISP")
(princ "Happy Birthday to You"))
Output:
Happy Birthday to You
Happy Birthday to You
Happy Birthday dear Common LISP
Happy Birthday to You
Batch, 72 bytes
@SET h=@ECHO Happy Birthday
%h%to You
%h%to You
%h%Dear Batch
%h%to You
COBOL, 185 Bytes
IDENTIFICATION DIVISION.
PROGRAM-ID. H.
PROCEDURE DIVISION.
PERFORM X.
PERFORM X.
DISPLAY 'Happy Birthday Dear COBOL'.
PERFORM X.
STOP RUN.
X.
DISPLAY 'Happy Birthday to You'.
STOP RUN.
I'm sure there is a shorter way but I don't know COBOL that well ;-)
Brainfuck, 593 characters
Used this
++++++++++[>+>+++>++++++>+++++++>++++++++>+++++++++>++++++++++>+++++++++++>++++++++++++<<<<<<<<<-]>>>>++.>>+++++++.>>++..>+.<<<<<<<++.>++++++.>>>>+++++.>++.++.<-.----.<.>>>.<<<<<<<.>>>>>>.-----.<<<<<<.>>>+++++++++.>>>.++++++.<<<<<<<.>>>.>>.>>-----..>.<<<<<<<.>.>>>>+++++.>++.++.<-.----.<.>>>.<<<<<<<.>>>>>>.-----.<<<<<<.>>>.>>>.++++++.<<<<<<<.>>>.>>.>>-----..>.<<<<<<<.>.>>>>+++++.>++.++.<-.----.<.>>>.<<<<<<<.>++.>>>>+.<.>>--.<<<<<<.>--.>>>>>.<<.>++++.>----.<---.>+++++++.<<++.>+++++.<<<<<<.>>>.>>--.>>-----..>.<<<<<<<.>.>>>>--.>++.++.<-.----.<.>>>.<<<<<<<.>>>>>>.-----.<<<<<<.>>>.>>>.++++++.
Any love for PHP? 61 59 58 bytes
$s="
Happy Birthday";echo$t="$s to You","$t$s Dear PHP$t";
PHP, 68 65 bytes
There are already 4 PHP answers, most of them shorter than this, but none using this feature, so:
for(;$i++<4;)echo"
Happy Birthday ",["to You","Dear PHP"][$i==3];
Am I the only one noticing that there´s a comma missing?
C++, 92 bytes
#include<iostream>
int main(int c){for(c=4;c--;)std::cout<<"Happy Birthday "<<(c-1?"To You":"Dear C++")<<"\n";}
C, 74 bytes
i=5;main(){while(--i)printf("Happy Birthday %s\n",i-2?"to You":"Dear C");}
Detailed
void main()
{
int i = 5;
while (--i > 0)
{
printf("Happy Birthday %s\n",
i!=2 ? "to You" : "Dear C" );
}
}
C# LinqPad, 103 bytes
Regex.Replace(String.Join("\n",Enumerable.Repeat("Happy Birthday to You",4)),"^((.*\n){2}.*)to.+","$1C#")
ArnoldC, 228 bytes
Lets make Arnold Schwarzenegger singing...
IT'S SHOWTIME
TALK TO THE HAND "Happy Birthday to You"
TALK TO THE HAND "Happy Birthday to You"
TALK TO THE HAND "Happy Birthday Dear ArnoldC"
TALK TO THE HAND "Happy Birthday to You"
YOU HAVE BEEN TERMINATED
output:
Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear ArnoldC
Happy Birthday to you
TI-Basic, 53 bytes
Well, since everyone is putting their favorite programming language up, I might as well add one of my old favorites. I spent a lot of time over the years (before I graduated to actual programming languages) typing commands into a window half the size of a smart phone.
"HAPPY BIRTHDAY TO YOU
Disp Ans,Ans,sub(Ans,1,15)+"DEAR TI-BASIC
Ans
My calculator doesn't support lowercase letters, and the only variables that can be strings are Str1, Str2 etc.
Edited Processing.js 80 bytes
var a="\nhappy birthday to you";print(a+a+"\nHappy birthday processing.js"+a);
Processing JS is a language that is fun but I am lazy and use an edited version that also is ungolfable. Try it online Println was used so you don't have to open the console :P
Khanacademy version
C, 73 bytes
main(c){for(;c-5;)printf("Happy Birthday %s\n",++c-4?"To You":"Dear C");}
Underload, 59 Bytes
(to You
):(Happy Birthday ):S~S:S~:S~:S(Dear Underload
)SSS
I was hindered by Underload's lack of stack manipulation commands. I had to push stuff in a strange order and swap a bit more than I would have preferred, but oh well...
Stack trace:
(...) | (to You)
: | (to You)(to You)
(...) | (to You)(to You)(Happy Birthday )
:S | (to You)(to You)(Happy Birthday ) ; output "Happy Birthday "
~ | (to You)(Happy Birthday )(to You)
S | (to You)(Happy Birthday ) ; output "to You"
:S | (to You)(Happy Birthday ) ; output "Happy Birthday "
~ | (Happy Birthday )(to You)
:S | (Happy Birthday )(to You) ; output "to You"
~ | (to You)(Happy Birthday )
:S | (to You)(Happy Birthday ) ; output "Happy Birthday "
(...) | (to You)(Happy Birthday )(Dear Underload)
S | (to You)(Happy Birthday ) ; output "Dear Underload"
S | (to You) ; output "Happy Birthday "
S | ; output "to You
Vim, 40 36 bytes
4OHappy Birthday to You<esc>k2bCDear Vim
4 bytes saved thanks to @DJMcMayhem by using O instead of i...\n and k2bC instead of kd2bC
This uses a completely different approach to the previous Vim answer and hence I posted it as a separate answer. Outputs a trailing newline, but can be removed at the cost of one extra byte by using Jk instead of k.
Since V is reverse compatible with V, you can Try it online!
Take that CJam!
JavaScript, 70 Bytes
a="Happy Birthday ";b=a+"to You\n";c=a+b;d=c+c+a+"Dear JavaScript\n"+c
Best answer JavaScript answer so far!
a="Happy Birthday ";
b=a+"to You\n";
c=a+b; // Create string "Happy Birthday to You\n"
d=c+c+a+"Dear JavaScript\n"+c // Create song
Implementation:
a="Happy Birthday ";b=a+"to You\n";c=a+b;d=c+c+a+"Dear JavaScript\n"+c
alert(d);
console.log(d);
Vim, 90 45 bytes
i
Happy Birthday to you
[ESC]
yypppPWWd$adear Vim
90 chars version:
i
Happy Birthday to you dear Vim
[ESC]
:%s/\(.* .* \)(.. .*\) \(.* .*\)/\1\2\r\1\2\r\1\3\r\1\2
I'm certain there is a quicker way but this is what I just came up with :)
Puts out
Happy Birthday to you
Happy Birthday to you
Happy Birthday dear Vim
Happy Birthday to you
05AB1E, 36 bytes
”ŽØ¢©”©" to You"«Ð®" Dear 05AB1E"«s»
Output:
Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear 05AB1E
Happy Birthday to You
Explanation:
”ŽØ¢©” Push "Happy Birthday"
STACK: ["Happy Birthday"]
© Store in register w/o popping
" to You"« Append " to You"
STACK: ["Happy Birthday to You"]
Ð Triplicate the string
STACK: ["Happy Birthday to You", "Happy Birthday to You", "Happy Birthday to You"]
® Push "Happy Birthday" from register
STACK: ["Happy Birthday to You", "Happy Birthday to You", "Happy Birthday to You", "Happy Birthday"]
" Dear 05AB1E"« Append " Dear 05AB1E"
STACK: ["Happy Birthday to You", "Happy Birthday to You", "Happy Birthday to You", "Happy Birthday Dear 05AB1E"]
s Swap top two strings
STACK: ["Happy Birthday to You", "Happy Birthday to You", "Happy Birthday Dear 05AB1E", "Happy Birthday to You"]
» Join by newlines
Pushy, 44 bytes
Pushy doesn't actually have a string type. However, it has the command ", which interprets the current stack as a character list and prints it.
`Happy Birthday `V`to You`""F`dear Pushy`"F"
It's quite simple:
`Happy Birthday ` % Push chars
V % Copy into stack 2
`to You` % Push chars
"" % Print stack 1 twice ("Happy Birthday to You")
F % Go to stack 2
`dear Pushy` % Push chars
" % Print stack ("Happy Birthday dear Pushy")
F" % Print other stack again to complete the song.
Basically, it uses the two stacks to construct the two needed strings, and prints them as it goes along. Here's the output:
$ pushy happybday.pshy Happy Birthday to You Happy Birthday to You Happy Birthday dear Pushy Happy Birthday to You
Mathematica- barcode birthday wishes--way too many bytes
This prints the verses and reads them aloud.

Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear Mathematica
Happy Birthday to You
StringReplace replaces each comma with a NewLine. Barcodes cannot contain control characters.
Reng, 66 bytes
Noncompeting.
A"uoY ot yadhtriB yppaH"¤ao;A"gneR raeD yadhtriB yppaH ~"S0gO0gao;
Simple enough. A is 10, or a newline. "uoY ot yadhtriB yppaH" pushes that string, ¤ duplicates the string, ao; outputs everything. The second part is more interesting. "A"gneR raeD yadhtriB yppaH ~" pushes that string. S pushes 28, and 0g sets the character at (0, 28) to the top of stack, or a ~, the end program signal. This sets the last A to a tilde. Then, O0g sets the character at(0, 24) to a space/nop, removing the duplicate stack command. We print the third line using ao;. Then, we wrap around to the beginning of the line and print the last line again.
Here's a GIF, because who doesn't like those?
///, 48 bytes
/U/Happy Birthday //T/Uto You/T
T
UDear \/\/\/
T
F#, 76 bytes
for i=0 to 3 do printfn"Happy Birthday %s"<|if i=2 then"Dear F#"else"to You"
jq: 54 52 characters
(49 characters code + 3 characters command line option.)
0,0,1,0|"Happy Birthday "+["to You","Dear jq"][.]
Sample run:
bash-4.3$ jq -n -r '0,0,1,0|"Happy Birthday "+["to You","Dear jq"][.]'
Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear jq
Happy Birthday to You
On-line test (Passing -r through URL is not supported – check Raw Output yourself.)
Seriously, 59 57 bytes (non-competitive)
"Happy Birthday to You";"Happy Birthday Dear Seriously"@;
Explanation
Push "Happy Birthday to You", duplicate, push "Happy Birthday Dear Seriously", rotate the two top elements, duplicate, and implicit popping and printing.
Retina, 47 49 50 52 bytes
The program is encoded as ISO-8559-1 (which the official interpreter accepts). The leading newline is significant.
¶¶x¶
Happy Birthday to You
.{27}u
Dear Retina
Explanation
Step 1: Replace the (empty) input with “newline, newline, x, newline”.
Step 2: In between every character, insert Happy Birthday to You. We now have:
Happy Birthday to You
Happy Birthday to You
Happy Birthday to YouxHappy Birthday to You
Happy Birthday to You
Step 3: replace a 28-character string ending in u and not containing a newline with Dear Retina. The only occurrence of that is to YouxHappy Birthday to You.
Staq, 67 66 chars
{h"Happy Birthday "}{T"To You"}{D"Dear Staq"}{N&iiqi,;}hTNhTNhDNhT
Result:
Executing D:\codegolf\Happy Birthday Staq.staq
Happy Birthday To You
Happy Birthday To You
Happy Birthday Dear Staq
Happy Birthday To You
Execution complete.
>
Milky Way 1.6.5, 56 bytes
I"Happy Birthday ":"Dear Milky Way"+;"to You"+::>>J§{!}
Explanation
I ` empty the stack
"Happy Birthday " ` push the string
:"Dear Milky Way"+ ` make the 3rd line
;"to You"+:: ` make the 1st, 2nd and 4th lines
>> ` put the lines in order
J§{!} ` print each line
Usage
$ ./mw <path-to-code>
Mouse-2002, 70 bytes
Mouse isn't very skilled at kolmogorov-complexity. :(
$H"Happy Birthday "@
$Y"to you!"@
#H;#Y;#H;#Y;#H;"Dear Mouse!"#H;#Y;$
The exclamation points print newlines, not themselves, and the $H and $Y are functions, not variables, because poor Mouse can't comprehend strings.
MUSYS, MUsic-SYStem, Mouse's predecessor, 93 bytes
"Happy Birthday to you!Happy Birthday to you!Happy birthday dear MUSYS!Happy Birthday to you"
C#, 91 bytes
var s="Happy Birthday to You\n";System.Console.Write(s+s+s.Substring(0, 15)+"Dear C#\n"+s);
Stringy, 78 bytes
(Happy birthday );a to you;p;p;^ to you!dear Stringy;p;^ dear Stringy!to you;p
Fishing, 116 bytes
v+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
`Happy Birthday `P{`to You`N}P{N}P{{`Dear Fishing`N}}P{N
G*, 76 bytes
G* is a golfing language I made but it seems it failed miserably :P (Note that this isn't even close to my favorite language but I wanted to give it a try at code golf.)
l 2 p Happy birthday to you;p Happy birthday dear G*;p Happy birthday to you
Here's another (longer) one:
1=Happy birthday to you;@ 1;@ 1;p Happy birthday dear G*;p Happy birthday to you
Bubblegum, 42 bytes
0000000: f3 48 2c 28 a8 54 70 ca 2c 2a c9 48 49 ac .H,(.Tp.,*.HI.
000000e: 54 28 c9 57 88 cc 2f e5 22 4a d4 25 35 b1 T(.W../."J.%5.
000001c: 48 c1 a9 34 29 29 27 35 bd 34 17 bb 1e 00 H..4))'5.4....
Note that this answer is non-competing, since Bubblegum is a lot younger than this challenge.
HPPPL (HP Prime Programming Language), 88
n:=char(10);a:="Happy Birthday ";b:="To You";c:="Dear HPPPL";d:=a+b+n;print(d+d+a+c+n+d)
Result:
HPPPL is the programming language for the HP Prime color graphing calculator/CAS. An emulator is available at the HP website.
CMD - 84 Bytes
cmd/v/c"set 1=to You&set 2=Dear CMD&for %a in (1,1,2,1)do @echo Happy Birthday !%a!"
Swift, 68 bytes
(1...4).map{print("Happy Birthday "+($0==3 ?"dear Swift":"to You"))}
also differently:
print({$0+$1+$0+$1+$0+"dear Swift"+$0+$1}("\nHappy Birthday ","to You"))
with 71 bytes
LOLCODE: 109 (105 with "correct" spelling)
LOLCODE is not a great language for golfing, especially since you lose all the beauty and expressiveness when shortening the code.
HAI
H R "HAPPY BIRTHDAY "
T R SMOOSH H "TO YOU"
VISIBLE T
VISIBLE T
VISIBLE SMOOSH H "DEAR LOLCODE"
VISIBLE T
This is my preferred rendition, weighing in at 187 characters (spaces added for clarity):
HAI
H R "HAPPY BERFDAY "
IM IN YR LOOP UPPIN YR N TIL BOTH SAEM N AN 4
VISIBLE H!
BOTH SAEM N AN 2, O RLY?
YA RLY
VISIBLE "DEER LOLCODE"
NO WAI
VISIBLE "2U"
OIC
IM OUTTA YR LOOP
KTHXBAI
><>, 157
v
\0&
v <
\&:&2(?v
>"Happy Birthday to you"a&1+&^
\"Happy Birthday dear ><>"a\
v a"uoy ot yadhtriB yppaH"/
r
>l?!;o
Big, but I wanted it to be different from the Befunge answer.
Shakespeare Programming Language, 3429 bytes
no one is going to be demented enough to enter a code-golf challenge with SPL, so...
My own words, a while ago. And yet, someone was demented enough to do it. Yes, yes, I know. Too much bytes. But SPL deserves to be included here, I think. And believe me, I've done a gargantuan effort to "golf" this program, which is why it's a bit repetitive and uses mostly the same words (I could always have followed DLosc's suggestion, but that would be too extreme even for me).
A Happy Birth Day
Ajax, a hero
Ford, a man
Act I: 1
Scene I: 1
[Enter Ajax and Ford]
Ajax:
You are nothing!
Scene II: 2
Ford:
Am I nicer than the sum of a big cow and a son?
Ajax:
If so, we shall go to Scene V. You are as big as the sum of thyself and a cat!
Scene III: 3
Ford:
You are as red as the sum of a big red warm rich bold fair cat and a big rich fine son.
Speak thy mind! You are as big as the sum of thyself and the sum of a cute fair fine
rich cat and a hog! Speak thy mind! You are as big as the sum of thyself and the sum
of a cute fair fine rich cat and a hog. Speak thy mind. Speak thy mind! You are as bold as
the sum of thyself and the sum of a big fine fair cat and a cow. Speak thy mind! You are
as big as a red old fair fine tiny cow. Speak thy mind! You are as old as the sum of
thyself and the sum of a red old fair fine tiny cow and a big joy. Speak thy mind.
You are as red as the sum of thyself and the sum of the sum of a red old fair fine
tiny cow and a rich old red sky and a pig. Speak thy mind! You are as old as the sum
of thyself and the sum of a big fine fair joy and a son. Speak thy mind. You are as
red as the sum of thyself and a cute son. Speak thy mind! You are as cute as the sum
of thyself and the sum of a bad fat vile pig and a fat bad lie. Speak thy mind! You are
as fat as the sum of thyself and a vile evil war. Speak thy mind! You are as vile as the
sum of thyself and the sum of a pig and a toad. Speak thy mind! You are as fair as the
sum of thyself and the sum of a big fair hard fine son and a red fine fair joy. Speak
thy mind! Are you as old as a big cow?
Ajax:
If so, we shall go to Scene IV.
Ford:
You are as big as a red old fair fine tiny cow. Speak thy mind! You are as old as the sum
of thyself and the sum of the sum of a big red warm rich bold fair cat and a red old fair
fine tiny cow and a bad hog. Speak thy mind! You are as big as the sum of thyself and the
sum of a fat bad hog and a war. Speak thy mind! You are as big as a red old fair fine tiny
cow. Speak thy mind! You are as old as the sum of thyself and the sum of a big red warm
rich bold fair cat and a fat foul bad hog and a son. Speak thy mind. You are as fat as
the sum of thyself and the sum of the sum of a big fair hard fine son and a big fine
fair joy and a bad pig. Speak thy mind.
Ajax:
Let us return to Scene II.
Scene IV: 4
Ford:
You are as big as a red old fair fine tiny cow. Speak thy mind! You are as old as the
sum of thyself and a big red warm rich bold fair cat and a warm sky. Speak thy mind.
You are as fat as the sum of thyself and the sum of a red old fair fine tiny cow and a
cat. Speak thy mind. You are as fat as the sum of thyself and a bad foul hog. Speak
thy mind. You are as cute as the sum of thyself and the sum of a big fair hard fine
son and a sky. Speak thy mind. You are as big as a red old fair fine tiny cow. Speak thy
mind! You are as old as the sum of thyself and the sum of thyself and the sum of the sum
of the sum of a red old fair fine tiny cow and a big fair hard fine son and a big joy and
a son. Speak thy mind. You are as bad as the sum of thyself and the sum of a fat pig and a
hog. Speak thy mind. You are as fat as the sum of thyself and a lazy pig. Speak thy mind.
Ajax:
Let us return to Scene II.
Scene V: 5
[Exeunt]
The meaning of all this?
OK, if you're curious about how all of this is supposed to work, let me try and explain my reasoning.
Firstly, the variables. They have to come from Shakesperian plays and, since tharacter count is important, we have to choose the small ones; thus, Ajax and Ford appear. They need a description after being declared (which is ignored, but still); I could've used a single letter, but heh.
Act I, Scene I
var Ajax, Ford;
Ford = 0;
We bring the variables into the stage and make Ajax tell Ford that his value will be 0.
Act I, Scene II
if (Ford > 2*1+1)
goto Scene V;
Ford = Ford + 1;
OK, if the value stored in Ford is bigger than 3, the program jumps to Scene V; otherwhise, its value is incremented.
Act I, Scene III
Ford = 2*2*2*2*2*2*1+2*2*2*1;
print((char) Ford);
Ford = Ford+2*2*2*2*1-1;
print((char) Ford);
Ford = Ford+2*2*2*2*1-1;
print((char) Ford);
print((char) Ford);
Ford = Ford+2*2*2*1+1;
print((char) Ford);
Ford = 2*2*2*2*2*1;
print((char) Ford);
Ford = Ford+2*2*2*2*2*1+2*2*2*1+(-1);
print((char) Ford);
Ford = Ford+2*2*2*1+1;
print((char) Ford);
Ford = Ford+2*1;
print((char) Ford);
Ford = Ford+2*2*2*(-1)+2*2*(-1);
print((char) Ford);
Ford = Ford+2*2*(-1);
print((char) Ford);
Ford = Ford+2*(-1)+(-1);
print((char) Ford);
Ford = Ford+2*2*2*2*1+2*2*2*1;
print((char) Ford);
if (Ajax == 2*1)
goto Scene IV;
Ford = 2*2*2*2*2*1;
print((char) Ford);
Ford = Ford+2*2*2*2*2*2*1+2*2*2*2*2*1+2*(-1);
print((char) Ford);
Ford = Ford+2*2*(-1)+(-1);
print((char) Ford);
Ford = 2*2*2*2*2*1;
print((char) Ford);
Ford = Ford+2*2*2*2*2*2*1+2*2*2*(-1)+1;
print((char) Ford);
Ford = Ford+2*2*2*2*1+2*2*2*1+2*(-1);
print((char) Ford);
Ford = Ford+2*2*2*1+2*-1;
print((char) Ford);
goto Scene II;
Loads and loads of lines. The idea is to fiddle with the value stored on Ford, doing loads and loads of arithmetic operations in order to get the ASCII number of the desired letters, then we tell the compiler to output the number in character form. That's how you write Happy Birthday.
There's an if inside this scene: the idea is to check if this is the third phrase of the song; if it is, we jump to Scene IV; otherwise we keep on forward, to write to You. After that, we jump back to Scene II.
Act I, Scene IV
Ford = 2*2*2*2*2*1;
print((char) Ford);
Ford = Ford+2*2*2*2*2*2*1+2*2*1;
print((char) Ford);
Ford = Ford+2*2*2*2*2*1+1;
print((char) Ford);
Ford = Ford+2*2*(-1);
print((char) Ford);
Ford = Ford+2*2*2*2*1+1;
print((char) Ford);
Ford = 2*2*2*2*2*1;
print((char) Ford);
Ford = Ford+2*2*2*2*2*1+2*2*2*2*1+2*1+1;
print((char) Ford);
Ford = Ford+2*(-1)+(-1);
print((char) Ford);
Ford = Ford+2*2*(-1);
print((char) Ford);
goto Scene II;
The way this works is similar to the Scene above: the idea is to write Dear SPL.
Act I, Scene V
End.
Just like that.
I still haven't found any place where this can be tested, unfortunately...
Lua - 72 bytes
Straightforward, but none of the other Lua programs work this way.
a,b,c='Happy Birthday ','to You\n','Dear Lua\n'io.write(a,b,a,b,a,c,a,b)
Cardinal, 113 107 88 82 characters
I fixed the errors in the original interpreter, so the operators work as specified. This enabled me to shrink down the code by another 19 25 characters:
4th version:
v8888#;++"lanidraC raeD " <
8%+++>>"Happy Birthday"-jv^
>8888@^ ;"uoY oT "<
Output, using my interpreter fixes:
Executing program..
Happy Birthday To You
Happy Birthday To You
Happy Birthday Dear Cardinal
Happy Birthday To You
Execution complete.
>
Second version, saving 6 chars: I changed the o’s and O’s to v^<> because the available interpreter has some errors with the handling of the rotation operators o and O, j and J and some other errors. One has to use the wrong rotation operators to make it work, but I prefer using a version that works according to specification. The length of the code stays the same. This version works properly with the interpreter provided at the link given at the bottom of my comment: (107 characters)
%->"Happy Birthd"v
x ^D+;"uoY oT ya"<
>"Happy Birthday D"v
v"ppaH";"lanidraC rae"<
>"y Birthday To You"@
Output, using the "original" faulty interpreter:
Executing program..
Happy Birthday To You
Happy Birthday To You
Happy Birthday Dear Cardinal
Happy Birthday To You
Execution complete.
>
You can test the program if you save it as txt file and drag it onto the interpreter exe for Windows.
http://esolangs.org/wiki/Cardinal
Here is the interpreter: http://floatation.webs.com/Cardinal.zip
Qt 5.4 qmake pro file, 119 bytes
Since the winner has already been announced, I thought I'd give a try for the witty category.
O=$$escape_expand(\n)
A=Happy Birthday
B=$$A to you$$O
CONFIG(debug,debug|release){log($$A dear qmake$$O)}log($$B)
This abuses qmake horribly.
qmake under default settings will parse a script 3 times over. For debug, release, and a build_pass. So we just let it throw out the "Happy Birthday" for all logs, with an extra "To you..." when a debug makefile is being generated.
Happy Birthday to you
Happy Birthday to you
Happy Birthday dear qmake
Happy Birthday to you
CJam, 46 42 bytes
"Happy Birthday to You
"___F<"Dear CJam
"@
How it works:
"Happy Birthday to You
"___ "Push "Happy Birthday to You\n" string to stack 4 times";
F< "From the last string, take only first 15 characters. F is a";
"Dear CJam "preinitialized variable whose value is 15";
" "Push "Dear CJam\n" to stack";
@ "Take the third string from end and put it to end";
This leaves the stack as following at the end of the code:
["Happy Birthday to You
" "Happy Birthday to You
" "Happy Birthday " "Dear CJam
" "Happy Birthday to You
"]
which are printed automatically to output as
Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear CJam
Happy Birthday to You
Try it here (Copy the code and run it)
JS 70 Bytes
alert([c=(a="Happy Birthday")+" to You",c,a+" Dear JS",c].join("\n"));
C (74 characters)
main(i){for(i=4;i;)printf("Happy birthday %s\n",i---2?"to You":"Dear C");}
Python 2 (72 characters)
for k in range(4):print"Happy birthday",k==2 and"Dear Python"or"to You"
Python 3 would need parentheses around the printed string, so two character more, so 74.
PHP (66 characters)
for($i=4;$i;)echo"Happy birthday ".($i---2?"to You\n":"Dear PHP\n");
SAS, 66 bytes
data;a='Happy Birthday';b=a||' to You';put b/b/a 'Dear SAS'/b;run;
><> 76 Bytes
Since it wasn't here already...
0>"Happy Birthda"{1+:}3-?vv
v^?=1l<;?=5}:{a"uoY oT y"<>"y Dear ><>"a
>{{o} ^
JMP/JSL, 67
Like the Mathematica example by David Carraher, this will 'sing' (...read) the Happy Birthday message to you out loud.
speak(x="\!nHappy Birthday";y=x||" to You";y||y||x||" Dear JSL"||y)
Output:
Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear JSL
Happy Birthday to You
For 7 less bytes you will have the Happy Birthday message printed for you in the log
K, 45 bytes
No one has sung Happy Birthday for everyone's favorite in-memory columnar database language? There, there:
`0:4 21#(57#"Happy Birthday to You"),"Dear K"
Very similar to the APL approach by @Moris Zucca- repeat the string Happy Birthday to You slightly more than two times and then glue on the Dear K. Reshaping into a 4x21 matrix repeats the initial line. In K, sending text to stdout requires the 0: IO verb. Without it (for 3 fewer characters), we would print:
4 21#(57#"Happy Birthday to You"),"Dear K"
("Happy Birthday to You"
"Happy Birthday to You"
"Happy Birthday Dear K"
"Happy Birthday to You")
An alternate 47 character solution I considered was:
`0:("Happy Birthday ",("to You";"Dear K")2=)'!4
This is about as straightforward as it gets- map a function over the sequence 0 1 2 3 given by !4, select the second half of the verse based on whether this index is equal to 2, glue on the start of the verse and then print the whole list out.
Casio CFX-9850G, 121 bytes 96
Just for the fun of it, the Happy Birthday song for the CFX-9850G graphing calculator.
Some instructions are just displayed as multiple bytes, but as far as I know they are encoded as 1 or 2 bytes. I marked them with colors. Edit: I checked the memory, so the program uses 121 bytes in the calculator.
The song text would not fit in a line, especially line 3 because in text mode the calculator can only display 7 rows and 21 columns. So I print the lyrics in graphing mode, which uses a tiny font.

Here is the output:

Julia, 75 67 65 characters
a,b,c="Happy Birthday ","To You\n","Dear Julia\n";print("$a$b$a$b$a$c$a$b")
a="Happy Birthday";b=("$a To You\n");print("$b$b$a Dear Julia\n$b")
a="Happy Birthday To You\n";print("$a$a$(a[1:15])Dear Julia\n$a")
Just for fun, here is an ungolfed version, with a loop (114 characters):
for i = 1:4
a,b,c = "Happy Birthday ","To You","Dear Julia"
i != 3 ? println("$a$b") : println("$a$c")
end
LaTeX, 182
This isn't intended to be a serious competitive entry, but just to do something fun. Therefore, disregard the char count. I don't need any golfing tips for this, because it is intentionally ungolfed.
\documentclass{article}
\newcommand{\h}[1]{Happy Birthday to {#1}}
\newcommand{\g}{\h{You}}
\begin{document}
\begin{verse}
\g \\
\g \\
\h{\LaTeX} \\
\g \\
\end{verse}
\end{document}
sh - 59
echo "${h=Happy Birthday }${y=to You}
$h$y
${h}Dear sh
$h$y
I thought this solution would be worth sharing too, even though there's a shorter one.
TeX - 70
\def\h{Happy Birthday }\def\y{to You}\h\y
\h\y
\h Dear TeX
\h\y\bye
Note that the line breaks are intentional and actually required.
C# (75) (73)
Using System.Diagnostics for the purpose of Debug.Print
Upgrade to @Abbas' code
string x="\nHappy Birthday ",y=x+"to You";Debug.Print(y+y+x+"Dear C#"+y);
Upgrade to @Tyress' code (83) (76)
for(int i=0;i++<4;)Debug.Print("Happy Birthday "+(i!=3?"to You":"Dear C#"));
Output:
Happy Birthday To You
Happy Birthday To You
Happy Birthday Dear C#
Happy Birthday To You
C++, 107
Nice:
#include <iostream>
int main(){[](){}();//<-Good Luck Charm
for (auto b : {false, false, true, false})
std::cout << "Happy Birthday " << (b ? "Dear C++" : "To You") << '\n';
}
Golfed:
#include <iostream>
int main(){for(int b:"\0\0?")std::cout<<"Happy Birthday "<<(b?"Dear C++":"To You")<<'\n';}
Befunge, 90
4v>$"uoY ot" v
v>0" yadhtriB yppaH" >:#,_$
< |-2\+49\0:
v>"egnufeB raeD">:#,_$1-:!#@_
PowerShell 92 (fixed)
$a="happy birthday to you";$a;$a;write-host -no $a.TrimEnd('to you');"y dear powershell" ;$a
this one is longer than the other PS solution but is unique and actually out puts the correct string
OLD -Powershell- - 62
$a="happy birthday to you";$a;$a;write "$a dear powershell";$a
Pyth, 42
V4+"Happy Birthday "?"to You"nN2"Dear Pyth
Demonstration:
$ pyth -c 'V4+"Happy Birthday "?"to You"nN2"Dear Pyth'
Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear Pyth
Happy Birthday to You
How it works:
V4 sets up a for loop, with N iterating over 0, 1, 2, 3.
Then, we create the string starting with "Happy Birthday ", and ending with "to You" if N does not equal 2 (nN2 calculates this), or ending with "Dear Pyth" otherwise.
Exact tie with CJam - language name and character count.
Alternative, 43 character solution:
J"Happy Birthday to You"JJ+<J15"Dear Pyth"J
It's one character longer because it needs an end quote.
APL: 45
4 23⍴'Dear APL',⍨61⍴'Happy birthday to you '
Explanation:
61⍴ reapeats the string up to length 61, after which "Dear APL" is concatenated (,)
Note that ⍨ inverts arguments, so it's added at the end.
4 23⍴ just makes a matrix 4x23 using the string on the right, starting from the beginning of the string each time it reaches the end.
Delphi - 124 122 115
Another Delphi XE2 try, this time without a loop.
{$APPTYPE CONSOLE}const l=#13#10;y='to you'+l;h='Happy birthday ';d='dear Delphi'+l;begin
Write(h+y+h+y+h+d+h+y)end.
Delphi, 154 146 139
uses{$APPTYPE CONSOLE}SysUtils,StrUtils;var i:byte;begin
for i:=0to 3do WriteLn('Happy birthday '+IfThen(i=2,'dear Delphi','to you'))end.
Deadfish (2610 2391 chars)
What's this? An output only challenge? Sound like it's a job for Deadfish!
iiisdsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiiiiiooiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiioiioddddddddddddoddddodddoiiiiiiiiiiiiiiiiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddsdddddodddddodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddddsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiioiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiiiiiooiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiioiioddddddddddddoddddodddoiiiiiiiiiiiiiiiiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddsdddddodddddodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddddsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiioiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiiiiiooiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiioiioddddddddddddoddddodddoiiiiiiiiiiiiiiiiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiiiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioddddoiiiiiiiiiiiiiiiiioddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiiiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioddddoiiioiioiiioiiiiiiiiiiodddddddddddoddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiiiiiooiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiioiioddddddddddddoddddodddoiiiiiiiiiiiiiiiiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddsdddddodddddodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddddsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiioiiiiiio
Unfortunately, because Deadfish only outputs integers, the code above outputs the ASCII representations of each character in the song.
If we use the specification that
Errors are not acknowledged: the shell simply adds a newline character!
then we can golf this down to 2391 chars:
iiisdsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiiiiiooiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiioiioddddddddddddoddddodddoiiiiiiiiiiiiiiiiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddsdddddodddddodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddddsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiioiiiiiiofdddddddddddddddddddddddddddddddddddddddddddddoiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiiiiiooiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiioiioddddddddddddoddddodddoiiiiiiiiiiiiiiiiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddsdddddodddddodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddddsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiioiiiiiiofdddddddddddddddddddddddddddddddddddddddddddddoiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiiiiiooiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiioiioddddddddddddoddddodddoiiiiiiiiiiiiiiiiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiiiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioddddoiiiiiiiiiiiiiiiiioddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiiiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioddddoiiioiioiiioiiiiiiiiiiodddddddddddofddddddddddddddddddddddddddddddddoiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiiiiiooiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiioiioddddddddddddoddddodddoiiiiiiiiiiiiiiiiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddsdddddodddddodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddddsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiioiiiiiio
Note: Deadfish isn't actually my favourite language, but I couldn't resist :P. Also golfing in Deadfish is a fun puzzle on its own.
Common Lisp (62 60 chars)
(format t"~@{Happy Birthday ~[to You~;dear CL~]~%~}"0 0 1 0)
Output
Happy Birthday to You
Happy Birthday to You
Happy Birthday dear CL
Happy Birthday to You
Intersystems Cache M, (71)
S X="Happy Birthday "
S Y="to You"
S Z="Dear M"
W X,Y,!,X,Y,!,X,Z,!,X,Y
Sample run...
USER>S X="Happy Birthday "
USER>S Y="to You"
USER>S Z="Dear M"
USER>W X,Y,!,X,Y,!,X,Z,!,X,Y
Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear M
Happy Birthday to You
PowerShell - 69 64 59
1,1,0,1|%{"Happy Birthday "+("Dear $ShellId","To You")[$_]}
and 91
$a,$b,$c="Happy Birthday.To You.Dear PowerShell".Split(".");1..2|%{"$a $b"};"$a $c";"$a $b"
and 108
$a=@();$b,$c="To You.Dear PowerShell".Split(".");1..4|%{$a+="Happy Birthday $b"};$a[2]=$a[2]-replace$b,$c;$a
Rant, 58 54 chars
[r:4]{Happy Birthday [alt:[nth:3;Dear Rant];to You]\N}
How it Works:
[r:4]- Sets repetitions of next block to 4.[alt: ... ; ...]- Executes alternate code if a primary pattern prints nothing.[nth:3;Dear Rant]- Prints "Dear Rant" on the third iteration.- If the
nthcondition is not satisfied, thealtfunction printsto You.
Clojure (104 76 characters)
(let[h "Happy Birthday" t "to You\n"](print h t h t h "Dear Clojure\n" h t))
which prints
Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear Clojure
Happy Birthday to You
C# (83)
using System;
for(int i=0;i<4;i++)Console.WriteLine("Happy Birthday "+(i!=2?"to You":"Dear C#"));
//Happy Birthday To You
//Happy Birthday To You
//Happy Birthday Dear C#
//Happy Birthday To You
Equally short (83 Bytes of code) is:
int i=0;while(i<4)Console.WriteLine("Happy Birthday "+(i++!=2?"to You":"Dear C#"));
PHP - 87 80 78 chars
<? $h="<br>Happy birthday ";$t="to you";$d="dear PHP";echo "$h$t$h$t$h$d$h$t";
I don't think that PHP is a good language for golfing, but I'm still practicing. And I love PHP :)
For the command line (strip off the short tags and replace the <br> with \n) 73 chars:
$h="\nHappy birthday ";$t="to you";$d="dear PHP";echo "$h$t$h$t$h$d$h$t";
Clojure -- 79
(map #(println"Happy Birthday"%)(assoc(vec(repeat 4"to You"))2"Dear Clojure"))
Powershell one liner: 73 71
1..4|%{"Happy Birthday $(if($_-eq3){"Dear Powershell"}else{"to You"})"}
J Script(63)
alert((a=(x="\nHappy Birthday ")+"to You")+a+x+"Dear JScript"+a)
Why J Script and not Java Script? -3 bytes:)
Javascript, 82
Yet another different js entry
a='Happy Birthday %s';b='to You\n';console.log(a+a+a+a,b,b,'Dear Javascript\n',b)
Falcon: 61
for i in[:4]:>"Happy Birthday "+(i==2?"Dear Falcon":"to You")
VBA 99
Why VBA? Why not?
Sub H(): For i = 0 To 3: MsgBox "Happy Birthday " & IIf(i = 2, "Dear VBA", "to You"): Next: End Sub
Ungolfed
Sub H()
For i = 0 To 3
MsgBox "Happy Birthday " & IIf(i = 2, "Dear VBA", "to You")
Next
End Sub
C# (Full program) - 162
namespace O{class P{static void Main(string[] a){for(int i=0;i<4;)System.Console.Write("Happy Birthday {0}\n",++i==3?"Dear god why do I golf in C#?":"to you");}}}
Rexx: 87
p='a'x;h='Happy Birthday';i='to you';ooray='dear Rexx'p;!=h i;say h i p h i p h ooray !
Output:
Happy Birthday to you
Happy Birthday to you
Happy Birthday dear Rexx
Happy Birthday to you
VBScript (75)
h="Happy Birthday "
l=vbLF
t="to You"&l
x=h&t
WScript.Echo x&x&h&"Dear VBS"&l&x
69 bytes if replacing WScript.Echo with MsgBox would be allowed.
Mathematica (65)
Print["Happy Birthday "<>#]&/@{s="to you",s,"dear Mathematica",s}
EcmaScript 6 - 64 о_О
[1,1,0,1].map(i=>"Happy Birthday "+(i?"to you":"ES6")).join("\n")
PowerShell 62
0..3|%{"Happy Birthday "+("to You","Dear PowerShell")[$_-eq2]}
Pascal (83) in maXbox
const H='Happy Birthday to You';
Speak(H+H+DelString(H,'to You')+'Dear Pascal'+H);
J : 53 bytes
'Dear J'(57+i.6)"_}'to You',"1~,~,:~'Happy Birthday '
,"1~,~,:~ and (57+i.6)"_ can probably be golfed further.
Python 3 - 61
Based on @Falko's answer I made one for Python 3.3. I slightly improved his code by removing the space at the beginning of "Dear Python" and using the space between 'Birthday' and 'to'.
H="\nHappy Birthday to You"
print((H*3)[:60]+"Dear Python"+H)
Total number of characters is 60 61.(thanks for the recount @manatwork)
Edit:
Two slightly different approaches, all with the same number of characters:
T="\nHappy Birthday to You"
print(T*2+T[:-6]+"Dear Python"+T)
or
print(T*2+T[:16]+"Dear Python"+T)
BTW: I would like to post this as a comment, but I do not have the rep.
Lua, 96 bytes
I was trying to be cool about this and make use of all the best Lua tricks I know but the guy who wrote a simple for loop with an if i==3 beat me by 20+ bytes >.<
Still, I think this is pretty cool in terms of Golfing:
a='Happy Birthday to you\ndear Lua\n'print(a:sub(0,-10):rep(3):sub(0,-8)..a:rep(2):sub(23,-10))
I was looking at recursively building the string a from a number using string.char() but I couldn't compress it anywhere near the length of a='Happy Birthday to you\ndear Lua\n'
Bc: 62 characters
(This demonstrates the language's only golfing strength: string literals are displayed even without the print statement.)
while(i++<4){"Happy Birthday "
if(i-3)"To You
"else"Dear bc
"}
Sample run:
bash-4.3$ bc <<< 'while(i++<4){"Happy Birthday "
> if(i-3)"To You
> "else"Dear bc
> "}'
Happy Birthday To You
Happy Birthday To You
Happy Birthday Dear bc
Happy Birthday To You
Marbelous, 151
Prints Happy Birthday every time hb is called, with either to you or Dear Marbelous appended, based on whether the input is 0 or 1. The passed marble in hb will not be outputted, as it will get stuck in the synchroniser &0.
03
00
02
01
hb
:hb
}0
=0&0
&1
&2//
746F20596F7544656172204D617262656C6F75730A
&0&0&0&0&0&0&1&1&1&1&1&1&1&1&1&1&1&1&1&1&2
486170707920426972746864617920
Below is the board hb, with hex converted to ascii text:

B - 109
(caveat: arguably not valid B, difficult to say - works with this)
main()v(4,"Happy Birthday to You HDear B");v(i,s){s[5]=i&5?'u':134744072;s[6]=&-247;i?puts(s)&v(i-1,s):0;}
C++, 136
#include<iostream>
int main(){static int i=0;std::cout<<"Happy Birthday "<<(i==2?"Dear C++":"to You")<<std::endl;return ++i<4?main():0;}
Visual FoxPro - 77
Not really my favorite language, but makes golfing somewhat interesting. Here is my greetings to it:
a="Happy Birthday "
b="to You"
?a+b
?a+b
?a+"Dear "+_screen.Caption
?a+b
This abuses the fact that _screen.Caption (the main window title) initially contains Microsoft Visual FoxPro, handy here. If I'm allowed to call the language by its "friendly name", I can just replace that for "Fox" and save 10 characters.
Groovy (64)
4.times{println"Happy Birthday ${it==2?'Dear Groovy':'to You'}"}
Railo CFML (79 characters)
for(i=1;i<5;i++){writeoutput("<br>Happy Birthday "&(i<>3?"to you":"dear CF"));}
Just having some fun creating a ridiculous mess:
variables.endings = ["H,a,p,p,y, ,B,i,r,t,h,d,a,y, ,t,o, ,y,o,u","H,a,p,p,y, ,B,i,r,t,h,d,a,y, ,t,o, ,y,o,u","H,a,p,p,y, ,B,i,r,t,h,d,a,y, ,d,e,a,r, ,C,o,l,d, ,F,u,s,i,o,n,n,n,n,n","H,a,p,p,y, ,B,i,r,t,h,d,a,y, ,t,o, ,y,o,u"];
variables.iVerse = '';
for (i = 1; i <= ArrayLen(variables.endings); i++) {
variables.iLine = '';
for (i2 = 1; i2 <= ListLen(variables.endings[i]); i2++) {
iLine = iLine & ListGetAt(variables.endings[i],i2);
}
variables.iVerse = variables.iVerse & variables.iLine;
if (i < ArrayLen(variables.endings)) {
variables.iVerse = variables.iVerse & "<br />";
}
}
writeOutput(variables.iVerse);
Swift, 83
Run this in Xcode Playground
let h="\nhappy birthday"
let t=" to you"
let f=h+t+h+t+h+" dear Swift"+h+t
print(f)
T-SQL (MS compliant): 75
print stuff(replicate('Happy Birthday to You '+char(10),4),62,6,'Dear SQL')
PHP 67 63 62
echo$z=($s="Happy Birthday").$t=" to You
","$z$s Dear PHP
$z";
EDIT: As @manatwork pointed out, without the second echo I have 4 chars less!!
EDIT2: Other improvement according to @manatwork
Rust, 98 bytes
fn main(){for i in range(0i,4){println!("Happy birthday {}",match i{2=>"dear Rust",_=>"to you"})}}
Befunge: 103
>"yadhtriB yppaH"67+>:#,_1g:"0"-v
2^_@#-"0"g20p10-1,,,,,,," to You"_1+01p"egnufeB raeD ">:#,_"0"02p#
1
GolfScript: 54 characters
4,{"Happy Birthday "["To You""Dear GolfScript"]@2==n}%
Sample run:
bash-4.3$ golfscript.rb <<< '4,{"Happy Birthday "["To You""Dear GolfScript"]@2==n}%'
Happy Birthday To You
Happy Birthday To You
Happy Birthday Dear GolfScript
Happy Birthday To You
C#
LINQPad (69):
string x="\nHappy Birthday ",y=x+"to You";(y+y+x+"Dear C#"+y).Dump();
Console (75):
string x="\nHappy Birthday ",y=x+"to You";Console.Write(y+y+x+"Dear C#"+y);
Ungolfed:
string x = "\nHappy Birthday ";
string y = x + "to You";
//LINQPad
(y + y + x + "Dear C#" + y).Dump();
//Console
Console.Write(y+y+x+"Dear C#"+y);
R, 69 chars
for(i in 1:4)cat('Happy Birthday',ifelse(i==3,'Dear R','to You'),'\n')
Or
for(i in 1:4)cat('Happy Birthday',if(i==3)'Dear R' else 'to You','\n')
All output:
Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear R
Happy Birthday to You
Otherwise with 66 characters there was, without the for loop:
a=rep('to You',4);a[3]='Dear R';cat(paste('Happy Birthday',a,'\n'))
But it outputs:
Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear R
Happy Birthday to You
JS, 83 bytes
h="Happy Birthday to You\n",console.log(h,h,h.replace("to You\n","Dear")+" JS\n",h)
or 79 bytes by @Ingo Bürk
h="Happy Birthday ",t="to You\n",console.log(h+t,h+t,h+"Dear Javascript\n",h+t)
or 71 bytes by @kapep
console.log(a=(b="Happy Birthday ")+"to You\n",a,b+"Dear Javascript\n",a)
or run on the console this page (42 bytes)
eval($("#answer-39759 code:first").text())
Var'aQ - 121
"Happy Birthday " ~ a cher "to you\n" tlheghrar ~ b cher b tlheghrar a "dear Var'aQ" tlheghrar tlheghrar b tlheghrar cha'
Lua: 91 72 characters
First pass:
for i=1,4 do io.write'Happy Birthday 'if i==3 then print'Dear Lua'else print'to You'end end
Even smaller:
for i=1,4 do print('Happy Birthday '..(i==3 and'Dear Lua'or'to You'))end
TI-BASIC: 65
:PROGRAM:H
:"HAPPY BIRTHDAY TO YOU
:Disp Ans,Ans,sub(Ans,1,15)+"DEAR TI-BASIC
:Disp Ans
In TI-BASIC, all built-in commands (even multi letter ones) are either one or two bytes on the calculator. The size I used represents the (minimum, since names take space) space taken by this code on my TI-84+SE running OS version 2.53MP. Seemingly wrong syntax (unclosed strings) is intentional.
TI-68k: 90
:h()
:Prgm
:"Happy Birthday to You"→a
:Disp a,a,mid(a,1,15)&"Dear TI-68k",a
:EndPrgm
Again, the size I used is the minimum real size on the calc (in this case, a TI-92).
Cobra - 78
class P
def main
print (t=(l='Happy Birthday ')+'to You\n')+t+l+'Dear Cobra\n'+t
J (44)
2|.'Happy birthday ',"1'dear J',>3#<'to you'
Python 85
[print('Happy Birthday %s'%('dear Python' if x==2 else 'to you')) for x in range(4)]
C: 87
#define p(a)printf("Happy birthday %s\n",a?a:"to you");
main(){p(0)p(0)p("dear C")p(0)}
Compiles fine, but since it doesn't return, it might not exit correctly. If you want it to return 0, it'll cost another seven characters:
#define p(a)printf("Happy birthday %s\n",a?a:"to you");
main(){p(0)p(0)p("dear C")return!p(0)}
Clojure : 87 chars
Golfed:
(let[h"Happy Birthday "s(str h"to You\n")t(str h"Dear Clojure\n")](print(str s s t s)))
Ungolfed:
(let [ h "Happy Birthday "
s (str h "to You\n")
t (str h "Dear Clojure\n") ]
(print (str s s t s)))
I just can't decide on just one language :/
BrainBack: 68
4 ["Happy birthday ">2 ->![<0 "to You
"]<[<0 "Dear BrainBack
"]<1 -]
BrainBack is a mix between BrainFuck and Forth, made for a PCG challenge Mar 7, 2014
Extended BrainFuck: 79
{h|"Happy Birthday ">}{t|"to You
">}&h&t&h&t&h|"Dear Extended BrainFuck
">&h&t
EBF's birthday is Jul 16, 2010
Scheme: 96
(R5RS, Racket, R6RS REPL)
(map(lambda(e)(display"Happy Birthday ")(display(if e "to You\n" "Dear Scheme\n")))'(1 1 #f 1))
Scheme was born Dec, 1975 (NB: PDF)
Zozotez: 96
((:'R(\(l)(p'|Happy birthday |())(p(?(a l)'|to You|'|Dear Zozotez|))(?(d l)(R(d l)))))'(t t()t))
However, It feels more right doing this one in French (86):
((:'A(\(l)(p'|Joyeux anniversaire|())(p(a l))(?(d l)(A(d l)))))'(, , | Zozotez,| |.|))
Output:
Joyeux anniversaire,
Joyeux anniversaire,
Joyeux anniversaire Zozotez,
Joyeux anniversaire.
Zozotez' birthday is Jul 19, 2011
BBC BASIC, 81 / 76 ASCII characters
Download interpreter at http://www.bbcbasic.co.uk/bbcwin/bbcwin.html
Unfortunately, it's not possible to choose between strings within an expression, so the line endings are repetitively encoded in a DATA statement. On the other hand, when you read the last line, it does sound quite musical.
FORk=1TO4READa$PRINT"Happy Birthday ";a$:NEXT
DATAto You,to You,Dear BASIC,to You
We can, however, choose what substring to select from a given string, for a saving of 5 characters (note that k=3 evaluates to -1 when true):
FORk=1TO4PRINT"Happy Birthday ";MID$("Dear BASICto You",11+(k=3)*10,10):NEXT
BBC BASIC, 69 ASCII characters
A shorter way:
a$="Happy Birthday "b$="to You"PRINTa$;b$'a$;b$'a$;"dear BASIC"'a$;b$
PowerShell 79
$a = 'Happy Birthday '
$b = 'to You'
"$a$b`n$a$b`n$($a)Dear PowerShell`n$a$b"
sh, 52
H()(echo Happy Birthday ${@-to You});H;H;H Dear sh;H
Perl - 58
say"Happy Birthday ".($_?"Dear Perl":"To You")for(0,0,1,0)
Run with:
perl -E'say"Happy Birthday ".($_?"Dear Perl":"To You")for(0,0,1,0)'
Just for fun:
perl -E'for(<HappyBirthday{0,1,2,3}>){s/B/ B/;s/2/ Dear Perl\n/;print s/\d/ To You\n/r}'
APL (48)
↑1⌽'Happy birthday '∘,¨(3/⊂'to you'),⊂'dear APL'
R: 70 bytes
Takes advantage of paste and vector recycling.
writeLines(paste(rep("Happy Birthday",4),c(rep("to You",2),"Dear R")))
JavaScript, 73
Run this in the console
for(h="",i=4;i;)h+='\nHappy Birthday '+(--i-1?'to You':'Dear JavaScript')
JavaScript, 74 73
for(i=5;--i;)console.log('Happy birthday',i-2?'to you':'dear JavaScript')
Thanks to Dancrumb for the byte-saving tip. It would be 68 67 bytes if I could use 4 alerts instead of newlines.
for(i=5;--i;)alert('Happy birthday',i-2?'to you':'dear JavaScript')
GNU dc, 51
[Happy Birthday to You]d[Happy Birthday Dear dc]rdf
Ruby, 54 bytes
I just thought "Hey, there's no Ruby answer yet", but then one appeared a few seconds before this one. Oh well...
puts h="Happy Birthday to You",h,h[0,15]+"Dear Ruby",h
Ruby, 56
x="Happy Birthday To You
"*4
x[59,6]="Dear Ruby"
puts x
CJam, 46 bytes
4,{"Happy Birthday "\2="Dear CJam""to You"?N}%
4, "Push [0,1,2,3].";
{ }% "Map...";
"Happy Birthday " "Push the string.";
\ "Swap top two stack elements (string and
array element)";
2= "Check equality with 2.";
"Dear CJam""to You" "Push two more strings.";
? "Select string based on result of 2=.";
N "Push a line break";
This leaves the following array on the stack:
["Happy Birthday " "to You" "\n" "Happy Birthday " "to You" "\n" "Happy Birthday " "Dear CJam" "\n" "Happy Birthday " "to You" "\n"]
Whose contents are automatically printed back-to-back at the end of the program.
Alternatively, with a for-loop and the same character count:
4{"Happy Birthday "I2="Dear CJam""to You"?N}fI



