##C - 115
C - 115
char b[1<<30];a;main(n){for(scanf("%d",&n);b[n]^=1;n=a)for (a=0;a+=n%10*(n%10),n/=10;);puts(n-1?"Unhappy":"Happy");} This uses a 230-byte (1GB) array as a bitmap to keep track of which numbers have been encountered in the cycle. On Linux, this actually works, and efficiently so, provided memory overcommitting is enabled (which it usually is by default). With overcommitting, pages of the array are allocated and zeroed on demand.
Note that compiling this program on Linux uses a gigabyte of RAM.