text:
How much bounty is out on Stackoverflow?
Task:
You are an amazing programmer and Stackoverflow-answerer, and you decide to answer every question with a bounty on Stackoverflow. You are so good, that you manage to get all the bounties in all the questions. While you wait for the rep to come flooding in, you write a program that goes and find out what the total amount of rep is in all those bounties.
Rules:

When run,

Your program will navigate through the featured tab on Stack Overflow.
It will scrape out the value of each bounty,
Then it will add it up and display the total

It has to download data from anywhere on SO (and only SO), but I would recommend using https://stackoverflow.com/questions?pagesize=50&sort=featured , as it is only about 10 pages
This is code-golf, so the shortest code wins

cough https://api.stackexchange.com/docs/featured-questions cough

http://stackoverflow.com/?tab=featured. All featured questions on 1 page.

@NateKerkhofs that's not all of them. Scroll to the bottom. eg when I just loaded it, it was showing 96 of 472 questions.

Bounty API

@justhalf already been discussed...

I'm pointing to the exact URL which will produce bounty scores, not just the API page as pointed out by @bazzargh. =)

Currently: 36100 (just if somebody is interested and does not want to execute a script)#

@moose how'd you figure that out?

@TheDoctor: I've executed one of the Python scripts below.

JavaScript - 176 133 130 108 106
function f()(t+=$("[title~=an]").text(),u=$("[rel*=x]")[0])?$("html").load(u.href,f):alert(eval(t));f(t=0)

Edit 1: trimmed some selectors down and used the ?: suggestion from Google's Closure Compiler (via @Sirko - thanks)
Edit 2: initialise s inside d and initialise t as 0 instead of ""
Edit 3: realised I don't actually need to target a specific container and can sweep the whole document, which gets rid of a bunch of .find calls and an unnecessary selector (plus the variable holding it)
Edit 4: shove the t initialiser in the function call to avoid a ; (it'll get hoisted to the top anyway) and squash the function down to one statement (combine two statements into one inside the ternary statement condition) to drop the {}
Note: I'm not sure if it's cheating, but this has to be run from a console window of a browser already pointing at http://stackoverflow.com/questions?page=1&sort=featured. It relies on the fact that jQuery and the appropriate paging links are available on the page itself. Also, it only appears to work in Firefox and not in IE or Chrome.
Output (at time of posting):
38150 (in an alert dialog)

Exploded/commented:
function f()
    //concat all the bounty labels to t (they take the format "+50")
    //happens to be elements with title attribute containing word 'an'
    (t+=$("[title~=an]").text(),
    //find the "next" (has rel=next attribute) button
    u = $("[rel*=x]")[0])
        ?
        //if there is a next button, load it, and then recurse f again
        $("html").load(u.href,f)
        :
        //else eval the 0+a+b+...+z tally and alert the result
        alert(eval(t))
//kick off the initial scrape (and simultaneously init the total tally)
f(t=0)

s=" #mainbar";d=$(s);t="";function a(){d.find(".bounty-indicator").each(function(){t+=this.innerHTML});(u=d.find("[rel=next]")[0])?d.load(u.href+s,a):alert(eval(t))}a(); 169 - used Google Closure Compiler.

Sneaky choice of language and context to bypass a lot of the required characters! (Such as "http://stackoverflow.com/") I like it!

I think you should mention that it is done using jQuery plugin. which I think it should be.. :)

Chrome throws a syntax error. Opening a function body with a ( paren, does that really work?

@Mr_Green - I already noted that, but I've bolded it to draw more attention...

@thejh - Works fine in Firefox, but you're right it doesn't seem to work in Chrome or IE (I've made a note). Obviously different implementations accept different things and Firefox must allow single statement function bodies in the same way that you can drop the {}s in similar if statements. My function now contains a single ternary statement: function f()a?b:c;, where a happens to be a multi-part "statement" contained by ().

I'd +1 if the browser took me to the right page before executing.

@primo - :) I don't begrudge you that... like I said in my own answer, it's a bit of a cheat. And I'm happy for it not to "win" as it certainly wouldn't be anywhere near the best score if it did include 50 odd extra characters of url. But I'll leave that to OP to judge.

Python - 232, 231, 195, 183, 176, 174
Parses the HTML from https://stackoverflow.com/questions?sort=featured using regular expressions.
The upper bound of range in the for loop must be number of pages + 1 or else the code will raise HTTPError because of 404s. Default number of results per-page is 15, which is what the code uses (omitting ?pagesize=50 saves on characters and is just as effective).
Thanks to @Gabe for the tip on reducing char count even further.
Golfed:
import requests,re;print sum(sum(map(int,re.findall(r"<.*>\+(\d+)<.*>",requests.get("https://stackoverflow.com/questions?sort=featured&page=%u"%i).text)))for i in range(1,33))

Output (at time of posting):
37700

Un-golfed:
Here's a somewhat un-golfed version that should be a bit easier to read and understand.
import requests, re

print sum(
          sum(
              map( int,
                   re.findall( r"<.*>\+(\d+)<.*>",
                               requests.get( "https://stackoverflow.com/questions?sort=featured&page=%u" % i).text
                   )
              )
          ) for i in range( 1, 33 )
      )

You can get rid of the explicit for loop and get it down to 176: import urllib,re;print sum(sum(map(int,re.findall(r"<.*>\+(\d+)<.*>",urllib.urlopen("http://stackoverflow.com/questions?sort=featured&page=%u"%i).read())))for i in range(1,33))

having a hardcoded upper bound makes it a little difficult to test

oh god

@WChargin, what?

It really isn't a good idea to parse HTML with regular expressions because it not guaranteed to work. More on that here: http://stackoverflow.com/questions/590747/using-regular-expressions-to-parse-html-why-not

@Richard Yeah, but this is code golf, so brevity trumps whether it's a "good idea".  I mean, in Real Life it's also not a good idea to write horrendous one-liners with no whitespace...

@Richard Parsing html and extracting from html are pretty different tasks. Since a website is not a stable API, nothing is guaranteed to work for this kind of extraction. Though Tony's code is a bit overgolfed, so it'd fail if there is any tag containing a + followed by a number. For example a question title could fit that format.

@CodesInChaos Thanks for the clarification. I figured it might be out of the scope of the question, but thought I would share.

174 by request of http://codegolf.stackexchange.com/a/25232/10740

Rebol - 164 133 130 (139 with 404 check)
Parses the html using the parse sub-language of Rebol. Checks the first 98 pages. I realised I have the same constraint as the python solution - too many repeats hit 404 errors and stop the execution.
Thanks to @rgchris for many improvements! Updated to check up to 98 pages.
s: 0 repeat n 99[parse read join http://stackoverflow.com/questions?sort=featured&page= n[15[thru{>+}copy x to{<}(s: s + do x)]]]s
With error checking for 404s (139):
s: 0 repeat n 99[attempt[parse read join http://stackoverflow.com/questions?sort=featured&page= n[15[thru{>+}copy x to{<}(s: s + do x)]]]]s
Test
>> s: 0 repeat n 20[parse read join http://stackoverflow.com/questions?sort=featured&page= n[15[thru{>+}copy x to{<}(s: s + do x)]]]s
== 23600

>> s: 0 repeat n 99[attempt[parse read join http://stackoverflow.com/questions?sort=featured&page= n[15[thru{>+}copy x to{<}(s: s + do x)]]]]s
Script: none Version: none Date: none
== 36050

Explanation
Rebol ignores whitespace, hence you can put it all on one line like that if you choose.  PARSE takes two inputs, and the first argument (read join ...) is fairly self-explanatory.   But here are some comments on the parse dialect instructions, in a more traditional indentation:
s: 0
repeat n 99 [
    parse read join http://stackoverflow.com/questions?sort=featured&page= n [
        ;-- match the enclosed pattern 15 times (the rule will fail politely when there are less entries)
        15 [
            ;-- seek the match position up THRU (and including) the string >+
            thru {>+}
            ;-- copy contents at the current position up TO (but not including) <
            copy x to {<}
            ;-- (Basically, run some non-dialected Rebol if this match point is reached) the do is a bit dangerous as it runs the string as code
            (s: s + do x)
        ]
    ]
]
;-- evaluator returns last value, we want the value in S
;-- (not the result of PARSE, that's a boolean on whether the end of input was reached)
s

Nice...I added an oridinary formatted version with some comments, hope you don't mind! It's always great to see how well Rebol nails so many problems with such literacy (all in a half-meg cross-platform Apache-licensed executable but that makes things like REFORM stick out like a sore thumb  Every other bit makes sense but I still look at that word and go "REduce and FORM being turned into REFORM" is just ugly.  Obsessing over it is very Hawthorne.  Oh, and you could change SOME to ANY and shave off a char! :-)

Oops, should be 133.

Note: You need to loop to a higher n value... there's currently 28 pages of bounties (for page size 15). Won't impact your char count though.

Thanks Alconja. Easy to go up to 98 pages before adding any more chars to the solution. I'll have to re-run the test from home tonight

Ruby, 260
require'open-uri'
require'zlib'
i=b=0
d=''
until /"has_more":f/=~d
i+=1
d=Zlib::GzipReader.new(open("http://api.stackexchange.com/2.2/questions/featured?site=stackoverflow&page=#{i}&pagesize=100")).read
b+=d.scan(/"bounty_amount":(\d+)/).map{|x|x[0].to_i}.reduce :+
end
p b

Uses the Stack Exchange API.
Output (as of time of original post):
37200

I'm not counting the &pagesize=100 in the character count, because it works without it, but I just added that for convenience while testing. If you remove that, it does the same thing (except it eats more quota and takes slightly longer).

Nice, I only got it to 275 in Python

eats more quota??? You were supposed to use the SO and SO only.

@JanDvorak ??? I meant API quota.

The requires can be replaced with the -r command line flag.

Rebmu - 108107
rtN99[parseRDrj[http://stackoverflow.com/questions?sort=featured&page=N][15[thru{>+}copyXto{<}(a+JdoX)]]]j

Test
(at 19:05 AEST)
>> rebmu [rtN99[parseRDrj[http://stackoverflow.com/questions?sort=featured&page=N][15[thru{>+}copyXto{<}(a+JdoX)]]]j]
Script: none Version: none Date: none
== 79200

Rebmu looks rather cryptic, but it is quite readable once you get the hang of it. Let's start by unmushing it and laying it out properly.
rt n 99 [
    parse rd rj [
        http://stackoverflow.com/questions?sort=featured&page= n
    ][
        15 [
            thru {>+}
            copy x to {<}
            (a+ j do x)
        ]
    ]
]
j

Rebmu is a dialect of Rebol so you can see the similarities in the solution.  Rebmu can't reduce the size of every statement yet, but it is an evolving language. Thanks again to @rgchris for the improvements to my first attempt.

ti (to integer!) would be safer than do in Rebmu with no change in code length.

Ruby - 197
Short version:
require 'nokogiri'
require 'open-uri'
s=0
(1..33).each{|p|Nokogiri::HTML(open("http://stackoverflow.com/questions?page=#{p}&sort=featured")).css('.bounty-indicator').each{|b|s+=b.content.to_i}}
p s

Human friendly version:
require 'nokogiri'
require 'open-uri'
s=0
(1..33).each do |p|
    Nokogiri::HTML(open("http://stackoverflow.com/questions?page=#{p}&sort=featured")).css('.bounty-indicator').each do |b|
        s += b.content.to_i
    end
end
puts s

And answer - 39700
Ruby with script parameters - 139
require 'nokogiri'
require 'open-uri'
s=0
(1..33).each{|p|Nokogiri::HTML(open(ARGV[0]+p.to_s)).css(ARGV[1]).each{|b|s+=b.content.to_i}}
p s

To run this from bash just type
ruby code_golf_stack_overflow2.rb http://stackoverflow.com/questions?sort=featured\&page= .bounty-indicator

The requires can be replaced with the -r command line flag.

PHP, 134, 131, 127
while($q=array_sum(preg_filter('#.*>\+#',0,file("http://stackoverflow.com/questions?sort=featured&page=".++$n))))$s+=$q;echo$s;
Will loop through all pages, pagesize is not set to save bytes so more GETs.
Very Very Dirty, but... taking advantage of PHP's "flaws" !

no space after echo
while stops at assignment
output after RegEx replace is a string starting with the bounty amount
array_sum() adds up strings
$n and $s are initialized, but starting from nothing is equiv. as starting from zero
etc...

PHP - 121 bytes
<?for(;preg_filter('/>\+(\d+)/e','$t+=\1',@file('http://stackoverflow.com/questions?sort=featured&page='.++$n)););echo$t;

Using a regex 'eval' modifier, to avoid using array_sum or similar. Seems to be the shortest solution among valid entries.

the e modifier has been deprecated as of PHP 5.5, but it is still useful for golfing nonetheless.

Javascript - 129 119 110 107 characters
EDIT: INVALID ANSWER! This only handles the "Top featured  questions", which only has a fraction of them. Alconja's answer is more valid.
s="#mainbar";t="";eval("$(s).find('.bounty-indicator').each(function(){t+=this.innerHTML});alert(eval(t))")

Execute on https://stackoverflow.com/?tab=featured in a console window. Based on the solution by Alconja.
Golfed it a bit more by removing unneeded whitespaces.
Used eval to remove the function call, clearing another 9 characters.
cleared out some more unneeded whitespace.

Bash 206
optimizations possible, too lazy
s=0;for i in `seq 1 11`;do for j in `wget -q -O - "http://stackoverflow.com/questions?pagesize=50&sort=featured&page=$i" | grep -o -E "bounty worth [0-9]*" | grep -o -E "[0-9]*"`;do s=$(($s+$j));done;done;echo $s

result:
39450

I could be wrong, but this looks like it could be very short with some quality optimizations.

seq 1 11 can be reduced to seq 11.

You should be able to get rid of the spaces around pipes to save four chars, and surely those two greps can be merged into one (did you mean "[0-9]+"?).

Also "grep -o -E" => "egrep -o".

And you can change: "egrep -o '[0-9]+'" => "cut -d' ' -f3" :)

Java, 540 chars
Warning: the number of active bounties is ~470. This code will access a page on stackoverflow that many times. It may get you in trouble with them for making so many data requests.
import java.io.*;import java.net.*;public class B{public static void main(String[]A){String u="http://stackoverflow.com/questions",d;Long i,s=i=0L,n=i.parseLong(o(u).replaceAll("^.*b.>(\\d+).*$","$1"));while(i++<n){d=o(u+"?pagesize=1&sort=featured&page="+n).replaceAll("^.*ion.>.(\\d+).*$","$1");s+=d.matches(".*\\D.*")?0:n.parseLong(d);}System.out.print(s);}static String o(String s){String d="";try{BufferedReader r=new BufferedReader(new InputStreamReader(new URL(s).openStream()));while((s=r.readLine())!=null)d+=s;}finally{return d;}}}

My output was 23400, but when I ran @TonyH's code, I got 37550. Bad news.
Pretty code:
import java.io.*;
import java.net.*;

public class StackOverflowBounty {

    public static void main(String[] args) {
        String u = "http://stackoverflow.com/questions", d;
        Long i, s = i = 0L, n = i.parseLong(o(u).replaceAll("^.*b.>(\\d+).*$", "$1"));
        while (i++ < n) {
            d = o(u + "?pagesize=1&sort=featured&page=" + n).replaceAll("^.*ion.>.(\\d+).*$", "$1");
            s += d.matches(".*\\D.*") ? 0 : n.parseLong(d);
        }
        System.out.print(s);
    }

    static String o(String s) {
        String d = "";
        try {
            BufferedReader r = new BufferedReader(new InputStreamReader(new URL(s).openStream()));
            while ((s = r.readLine()) != null) {
                d += s;
            }
        } finally {
            return d;
        }
    }
}

The way this works is simple. It reads from the url http://stackoverflow.com/questions" to determine the number of questions that have bounties (note: if the number increases, the program fails, but if it drops, it works fine). It searches for this number using the regex: b.>(\\d+). This has worked in all tests to date, but if someone asked a question that matches that regex, this might not work.
Then, we open the url http://stackoverflow.com/questions?pagesize=1&sort=featured&page= + current question #. In other words, we open a new page for each featured question, and force the number of questions to be only 1, so we will get them all. The reputation part will always match ion.>.(\\d+), so I use that to find it. I split the operation into two parts so that I could cheaply check if the number of questions reduced (ie the string returned is not an integer).
Then, we sum up all the reputation and print it.
It took about 3 minutes and 20 seconds to run on my machine.

Does anyone know why it isn't printing the right number?

pagesize=100 gives the large number. I think something weird is happening because you're passing pagesize=1. In my answer, if i didn't specify 'pagesize', the result was close to your number.

@malik Yeah I realized that I "misread" your comment, so I deleted mine :-). pagesize=100 acts as if pagesize=50. Did you mean that you ran my code with pagesize=100?

C# - 407
class B{void Main(string[] a){var o=0;for(int i=1;i<11;i++){var r=((System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(new Uri(string.Format(a[0]+"&page={0}",i)))).GetResponse();if(r.ContentLength>0){using(var s=new StreamReader(r.GetResponseStream()))foreach(Match m in Regex.Matches(s.ReadToEnd(),"bounty worth (.+?) "))o+=int.Parse(m.Value.Substring(m.Value.IndexOf('h')+2));}}Console.Write(o);}}

Using Stackoverflow.com. Same as below, except no Gzip decompressing and different regex.
Test
> prog.exe http://stackoverflow.com/questions?pagesize=50&sort=featured
38150

Weirdly, getting a different value than below.

C# - 496
This uses api.stackexchange which is gzipped and json.
using System.IO.Compression;class B{void Main(string[] a){var o=0;for(int i=1;i<11;i++){var r=((System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(new Uri(string.Format(a[0]+"&page={0}",i)))).GetResponse();if(r.ContentLength>0)using(var s=new StreamReader(new GZipStream(r.GetResponseStream(),CompressionMode.Decompress)))foreach(Match m in Regex.Matches(s.ReadToEnd(),@"bounty_amount"":(.+?),"))o+=int.Parse(m.Value.Substring(m.Value.IndexOf(':')+1).Replace(",",""));}Console.Write(o);}}

Unminified:
using System.IO.Compression;

class B
{
    void Main(string[] a)
    {
        var o = 0;
        for (int i=1; i<11; i++) {
            var w = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(new Uri(string.Format(a[0]+"&page={0}",i)));
            if(w.GetResponse().ContentLength > 0)
                using(var s = new StreamReader(new GZipStream(w.GetResponse().GetResponseStream(),CompressionMode.Decompress)))
                    foreach(Match m in Regex.Matches(s.ReadToEnd(), @"bounty_amount"":(.+?),"))
                        o += int.Parse(m.Value.Substring(m.Value.IndexOf(':')+1).Replace(",", ""));
        }
        Console.Write(o);
    }
}

Test
Default pagesize:
> prog.exe http://api.stackexchange.com/2.2/questions/featured?site=stackoverflow
25300

Pagesize=100:
> prog.exe "http://api.stackexchange.com/2.2/questions/featured?site=stackoverflow&pagesize=100"
37400

jQuery 191
i=0;function f(p){$.get('//api.stackexchange.com/2.2/questions/featured?site=stackoverflow&page='+p,function(d){for(x in d.items)i+=d.items[x].bounty_amount;d.has_more?f(p+1):alert(i)})};f(1)

It works from anywhere in stackexchange(and many other sites), no need to be in a specific page as in @Alconja/@NateKerkhofs answers

jQuery's a library, not a language. Not sure if it's valid or not...

@br1ckb0t take it as javascript if you like. jQuery is already on stackexchange sites anyways, I was just being explicit about the $

Yep, that makes sense! Nice code.

PHP - 139
Golfed:
<?php
$a=file_get_contents('http://stackoverflow.com/?tab=featured');preg_match_all('/n">\+([0-9]+)<\/div>/',$a,$r);echo array_sum($r[1]);

Ungolfed - 147
Simple file_get_contents / preg_match / array_sum
<?php
$a = file_get_contents('http://stackoverflow.com/?tab=featured');
preg_match_all('/n">\+([0-9]+)<\/div>/', $a, $r);
echo array_sum($r[1]);

Test:

php run.php
10250

Python (174 characters):
Expanding on the python answer above (don't have enough karma to comment):
import requests,re;print sum(sum(map(int,re.findall(r"<.*>\+(\d+)<.*>",requests.get("http://stackoverflow.com/questions?sort=featured&page=%u"%i).text)))for i in range(1,33))

Requests in lieu of urllib cuts down on 2 chars.

Bash 174
Based on https://codegolf.stackexchange.com/a/25180/7664:
s=0;for i in {1..11};do for j in `wget -qO- "stackoverflow.com/questions?pagesize=50&sort=featured&page=$i"|cut -d' ' -f18|egrep '^[0-9]+$'`;do s=$(($s+$j));done;done;echo $s

You can get rid of the pagesize=50& and just loop more (I think the default page size if 15).

@Alconja Hmm, right, so I could get this down to 162... but only with the downside of more request spam to the server.

Ruby (176 chars):
Following Tony H.'s example of using hard-coded page numbers, here's what I got:
require'open-uri';b=0;(1..29).each{|i|d=open("http://stackoverflow.com/questions?sort=featured&page=#{i}").read;b+=d.scan(/<.*>\+(\d+)<.*>/).map{|x|x[0].to_i}.reduce 0,:+};p b

gave me 35300 at the time of writing.

authors: Кирилл Малышев

authors: виктор крекотин


text:
Tower of Hanoi Sort
Write a function/subroutine to sort a list of integers, Tower of Hanoi style.
You will be given a stack of integers. This is the main stack.
You are also given two more helper stacks. These helper stacks have a unique property though: every element must be smaller than or the same size as the element underneath it. The main stack has no such restriction.
You are tasked with sorting the main stack in place, putting the largest integers underneath. Your function/subroutine will return (or equivalent) the number of moves it made in sorting the stack.
Note: you must sort the main stack in place, no sorting onto another stack and calling that the answer. However, if you for some reason cannot do so, you may simulate the mutable stacks, but remember that this is Tower of Hanoi sort; there are only 3 pegs and only 1 peg may be unordered.
Your function/subroutine can inspect any stack at any time, but it can only make a move by popping and pushing. A single move is a pop from one stack which is pushed to another.
Test your function/subroutine for each permutation of the first 6 natural numbers. In other words, test your function/subroutine for {1},{2},...,{6},{1,1},{1,2},...,{1,6},{2,1},... (this should be a total of 61+62+...+66 or 55986 possibilities (thanks to Howard for correcting my math)). The function/subroutine that moves elements the least number of times wins.

@JanDvorak That was sort of the idea on the tests. If the programmer needs to run the function 46656 times, why would he/she want to wait so long for the output? Or is there another good way of restricting this sort of thing?

Somehow I like the blind-zap challenge: you can only say "move from stack x to stack y" and see if your move succeeds, and if it does, you get charged for it; bonus points is move failure is indicated by throwing an exception / returning correctly.

@JanDvorak Doesn't that encourage the simplistic method of simply finding a valid move and doing it? And I actually intended this as a sorting method (a rather fun but slow one).

so, full-view, and the askers must actually run their solutions? I can go with that.

What about languages without mutable data structures (haskell, golfscript, J)? Can we get away with having to discard the old stack once its new version is obtained?

@JanDvorak Yes. Just simulate a mutable stack to the best possible ability, and it should be good. But the moves need to act as if they are to the main stack (think Tower of Hanoi, there are only 3 pegs. In this challenge, only one peg has a misordering problem).

I would love to see a solution in Befunge 98 using { and }. TOSS the SOSS ftw!

That would be cool indeed. I'm not fluent in B98, unfortunately.

The list of "permutations" you gave contains 6**1+6**2+...+6**6=55986 elements.

"The function/subroutine that moves elements the least number of times wins." Does this refer to the sum over all those 55986 test cases?

Hmm too bad this has received so little attention. There seem to be nice ways to solve it, like this one: http://en.wikipedia.org/wiki/Tower_of_Hanoi#Binary_solution. Maybe I'll give it a try!

Please reword "permutations" as "cartesian product"

@user80551 This is not "cartesian product". It is the set of permutations of the 1st 6 natural numbers. I use the {} to separate the lists that would be inputted. The list of lists: {1},{2},...,{6},{1,1},{1,2},...,{2,1},...,{1,1,1},{1,1,2},...,{1,1,1,1,1,1},...,{6,6,6,6,6,6}

@m.buettner Yes. Call your function/subroutine for those 55986 cases and find the sum of the outputs. This is the score for your answer.

@Quincunx I'm pretty sure these are in fact the elements of cartesian products of {1,2,3,4,5,6} with itself 1 to 6 times. Permutations would be {1,2,3,4,5,6}, {4,1,3,2,6,5}, {2,3,6,1,4,5} and so on.

(In fact, the combinatorics hint at a cartesian product as well. For counting permutations factorials are used. For counting elements in a cartesian product you multiply the sizes of the things multiplied together - i.e. raise something to some power if you take the cartesian product with itself.)

@m.buettner The distinction is that this is the elements of cartesian products 1 to 6 times. I'd probably call this "the set of permutations of each element of the power set of the first 6 natural numbers except the null set."

@Quincunx except the power set doesn't contain sets with repeated numbers. ;) ... but I don't think we should take this too seriously anyway, as long as we're all clear about the elements in the set.

It's not permutations but combinations (up to length 6). The permutations of the numbers 1 to 6 are {1,2,3,4,5,6}, {1,2,3,4,6,5}, {1,2,3,5,4,6}, {1,2,3,5,6,4}, {1,2,3,6,4,5}, {1,2,3,6,5,4}, …, {6,5,4,3,1,2}, {6,5,4,3,2,1}.

Similar? http://stackoverflow.com/questions/4347718/code-golf-towers-of-hanoi

@Quincunx: I've answered with a lower number of moves than the currently accepted one :)

New best submission (1080544 moves) posted :)

Java - optimal solution (1080544 moves)
This solution builds a shortest path tree from the target and backwards, then traverses the path from the initial state to the target. Lots of room for speed improvement, but it still completes all 55986 problems in about a minute.
Assuming the algorithm is correctly implemented, this should be the theoretically best solution.
import java.util.*;

public class HanoiSort {

    public static void main(String[] args) {
        int sumNumMoves = 0;
        for (int size = 1; size <= 6; ++size) {
            Collection<List<Integer>> initMainStacks = generateInitMainStacks(Collections.<Integer>emptyList(), size);
            for (List<Integer> initMainStack : initMainStacks) {
                sumNumMoves += solve(initMainStack);
            }
        }
        System.out.println(sumNumMoves);
    }

    /*
     * Recursively create initial main stacks
     */
    private static Collection<List<Integer>> generateInitMainStacks(List<Integer> mainStack, int remainingSize) {
        Collection<List<Integer>> initMainStacks;
        if (remainingSize > 0) {
            initMainStacks = new ArrayList<>();
            for (int number = 1; number <= 6; ++number) {
                List<Integer> nextMainStack = new ArrayList<>(mainStack);
                nextMainStack.add(number);
                initMainStacks.addAll(generateInitMainStacks(nextMainStack, remainingSize - 1));
            }
        } else {
            List<Integer> initMainStack = new ArrayList<>(mainStack);
            initMainStacks = Collections.singleton(initMainStack);
        }
        return initMainStacks;
    }

    private static final List<Integer> EMPTY_STACK = Collections.emptyList();

    /*
     * Create a shortest path tree, starting from the target state (sorted main stack). Break when the initial state
     * is found, since there can be no shorter path. This is akin to building a chess endgame tablebase.
     *
     * Traverse the path from initial state to the target state to count the number of moves.
     */
    private static int solve(List<Integer> initMainStack) {
        List<List<Integer>> initState = Arrays.asList(new ArrayList<>(initMainStack), EMPTY_STACK, EMPTY_STACK);
        List<Integer> targetMainStack = new ArrayList<>(initMainStack);
        Collections.sort(targetMainStack);
        List<List<Integer>> targetState = Arrays.asList(new ArrayList<>(targetMainStack), EMPTY_STACK, EMPTY_STACK);
        Map<List<List<Integer>>,List<List<Integer>>> tablebase = new HashMap<>();
        Deque<List<List<Integer>>> workQueue = new ArrayDeque<>();
        tablebase.put(targetState, null);
        workQueue.add(targetState);
        while (!tablebase.containsKey(initState)) {
            assert !workQueue.isEmpty() : initState.toString();
            List<List<Integer>> state = workQueue.removeFirst();
            Collection<List<List<Integer>>> prevStates = calcPrevStates(state);
            for (List<List<Integer>> prevState : prevStates) {
                if (!tablebase.containsKey(prevState)) {
                    tablebase.put(prevState, state);
                    workQueue.add(prevState);
                }
            }
        }

        int numMoves = 0;
        List<List<Integer>> state = tablebase.get(initState);
        while (state != null) {
            ++numMoves;
            state = tablebase.get(state);
        }
        return numMoves;
    }

    /*
     * Given a state, calculate all possible previous states
     */
    private static Collection<List<List<Integer>>> calcPrevStates(List<List<Integer>> state) {
        Collection<List<List<Integer>>> prevStates = new ArrayList<>();
        for (int fromStackNo = 0; fromStackNo < 3; ++fromStackNo) {
            List<Integer> fromStack = state.get(fromStackNo);
            if (!fromStack.isEmpty()) {
                int number = fromStack.get(0);
                for (int toStackNo = 0; toStackNo < 3; ++toStackNo) {
                    if (toStackNo != fromStackNo) {
                        List<Integer> toStack = state.get(toStackNo);
                        if ((toStackNo == 0) || toStack.isEmpty() || (toStack.get(0) >= number)) {
                            List<List<Integer>> prevState = new ArrayList<>(state);
                            List<Integer> prevFromStack = new ArrayList<>(fromStack);
                            prevFromStack.remove(0);
                            prevState.set(fromStackNo, prevFromStack);
                            List<Integer> prevToStack = new ArrayList<>(toStack);
                            prevToStack.add(0, number);
                            prevState.set(toStackNo, prevToStack);
                            prevStates.add(prevState);
                        }
                    }
                }
            }
        }
        return prevStates;
    }

}

Care to explain more on what you mean by "shortest path tree"?

Anyway thanks for your answer, it makes me glad that I can achieve near optimal solution using heuristics only :)

A shortest path tree is a tree in which each node/state has one "next" edge, leading to the node/state that, in turn, has the shortest distanced to the root/target state (= sorted main stack). There might be other candidate next nodes that have the same distance or more, but none that are closer to the root. For this problem, all edges in the shortest path tree has a distance of one, since it takes one move to get from one state to another. Basically, a complete shortest path tree contains the solution for all states that have the same target state.

@justhalf Forgot to mention you in my comment. BTW, see also http://en.wikipedia.org/wiki/Retrograde_analysis

Python,  3983838 3912258 moves over 55986 inputs
This is very inefficient.
I'll add the total number of moves after the OP clarifies whether they are for all of those cases or for specific other cases.

from itertools import product       # Required for testing
import time                         # Required if you want to see it in action.

from pycallgraph import PyCallGraph
from pycallgraph.output import GraphvizOutput

def main( l ):
    ################### Data ###################
    global a , b , c , d , copy , total_moves
    total_moves = 0

    a = [ x for x in l ]  # Input stack, order doesn't matter, we'll try to empty this one
    b = []                # Usable stack, restricted by order, we'll try to get the final sorted order here
    c = []                # Usable stack, restricted by order, but we'll try to keep it as empty as possible

    d = { 'a':a , 'b':b , 'c':c }  # Passing the stacks to the nested functions by their names as a string
    copy = [ x for x in a ]        # reference copy, read-only

    ################### Functions ###################
    def is_correct( stack ):
        if d[ stack ] == sorted( copy , reverse = True ):
            return True
        else:
            return False

    def reverse_exchange( source , destination , keep = 0 ):
        #
        # keep is the number of elements to keep at the bottom of the source stack
        # The remaining top elements are moved to the destination stack
        # We first move the top elements to stack a
        # and from a to c so that the order is preserved
        # effectively splitting the source stack into two
        #

        i = 0
        while len( d[ source ] ) > keep :
            move( source , 'a' )
            i += 1
        else:
            while i > 0:
                move( 'a' , destination )
                i -= 1

    # def validate( source , destination ):
    #   #
    #   # Validates the give move
    #   #
    #   if len( d[ source ] ) == 0:
    #       return False
    #   if destination == 'a' or len( d[ destination ] ) == 0:
    #       return True
    #   else:
    #       if d[ destination ][ len( d[ destination ] ) - 1 ] >= d[ source ][ len( d[ source ] ) - 1 ]:
    #           return True
    #       else:
    #           return False

    def move( source , destination ):
        global total_moves
        # if validate( source , destination ):
        d[ destination ].append( d[ source ].pop() )

        total_moves += 1

            # Uncomment the following to view the workings step-by-step
            # print '\n'
            # print a
            # print b
            # print c
            # print '\n'
            # time.sleep(0.1)

        return True
        # else:
        #   return False

    ################### Actual logic ###################
    while ( not is_correct( 'a' ) ):

        copy_b   = [x for x in b ]                         # Checking where the topmost element of a
        top_of_a = a[ len(a) - 1 ]                         # should be inserted
        copy_b.append( top_of_a )                          #
        sorted_copy_b = sorted( copy_b , reverse = True )  #

        reverse_exchange( 'b' , 'c' , sorted_copy_b.index( top_of_a ) )                                                  # Sandwiching the top-most element
        move( 'a' , 'b' )                                                                                # to proper position in b
        while (len(b) > 0 and len(c) > 0 and len(a) > 0) and (sorted (b , reverse = True)[0] <= a[len(a) - 1] <= c[0]):  #  # Optimization
            move( 'a' , 'b' )                                                                                #  #
        reverse_exchange( 'c' , 'b' )                                                                                # b is always sorted, c is always empty

        if is_correct( 'b' ):                     # Just moving b to a
            while ( not is_correct( 'a' ) ):      # The entire program focuses on "insertion sorting"
                reverse_exchange( 'b' , 'c' , 1 ) # elements of a onto b while keeping c empty
                move( 'b' , 'a' )                 #
                if len(c) > 0 :                       #
                    reverse_exchange( 'c' , 'b' , 1 ) # Slightly more efficient
                    move('c' , 'a' )                  #

    return total_moves

# with PyCallGraph( output= GraphvizOutput() ):

    ################### Test cases #############
i = 0
for elements in xrange( 1 , 7 ):
    for cartesian_product in product( [ 1 , 2 , 3 , 4 , 5 , 6 ] , repeat = elements ):
        input_list = [ int( y ) for y in cartesian_product ]
        i += main(input_list)
        print i
print i

Explanation
What, comments not good enough for you?

Note to OP: Thanks for not making this code-golf.

I believe that if there is a more interesting way of doing the challenge other than [code-golf], it should be done that way.

Ok, this fails for [1,1,2]. In python, considering a list [2,1,1] is there a way to get [2,1,1].index(1) as 2 i.e. starting from higher end?

@Quincunx No, [2,1,1,3,5].index(1)==2 instead of 1

Er, list.index(data) returns the index of the item data in list. I don't know the index of data i.e. 1

The hack would be len(list)-(list[::-1].index(1))

Oh. I didn't get it. Oops. You could do list[list.index(1):].index(1) to get what you want. To get a list of the indexes of every element, perhaps [x for x in range(len(list)) and list[x] == elementIAmLookingFor]

@Quincunx Thanks, but nvm the bug was in the validate method.

You average ~99 moves per stack. Hmm. Interesting that this is so since 2**6 = 64 and I think that it is possible to get close to that value. I'm working on an algorithm that should get less than 2**n + n when n is the number of elements, if my math is perfect (which I proved it isn't in asking this challenge).

@Quincunx I made it slightly better so that it alternates between b and c when putting the final output back into a.

Slightly better? That's a lot better :-)

C - 2547172 for 55986 inputs
There is a lot of room for improvement here. For my own sanity, I simplified this so that it was only possible to inspect the top element of each stack. Lifting this self-imposed restriction would allow optimizations like determining the final order in advance and trying to minimize the number of moves required to achieve it. A compelling example is that my implementation has worst case behavior if the main stack is already sorted.
Algorithm:

Fill both auxiliary stacks (room for optimization here, possibly assigning to which stack based on some kind of pivot).
Merge sort the auxiliary stacks back onto the main stack.
Repeat 1-2 until the main stack is sorted (but in reverse).
Reverse the main stack (more room for optimization, shuffling a lot of the same elements repeatedly).

Analysis:

Additional space complexity is O(n) (for the two auxiliary stacks), which is good, since that was a requirement of the problem.
Time complexity is O(n^2) by my count. Corrections are welcome.

#include <assert.h>
#include <stdio.h>

#define SIZE 6

int s0[SIZE + 1];
int s1[SIZE + 1];
int s2[SIZE + 1];

int
count(int *stack)
{
    return stack[0];
}

int
top(int *stack)
{
    return stack[stack[0]];
}

void
push(int *stack, int value)
{
    assert(count(stack) < SIZE && "stack overflow");
    assert((stack == s0 || count(stack) == 0 || value <= top(stack)) && "stack order violated");
    stack[++stack[0]] = value;
}

int
pop(int *stack)
{
    int result = stack[stack[0]];
    assert(count(stack) > 0 && "stack underflow");
    stack[stack[0]] = 0;
    stack[0]--;
    return result;
}

int permutations;

void
permute(int len, int range, void (*cb)(void))
{
    int i;
    if(len == 0)
    {
        permutations++;
        cb();
        return;
    }
    for(i = 1; i <= range; i++)
    {
        push(s0, i);
        permute(len - 1, range, cb);
        pop(s0);
    }
}

void
print(void)
{
    int i;
    for(i = 1; i <= count(s0); i++)
    {
        printf("%d ", s0[i]);
    }
    printf("\n");
}

int save[SIZE + 1];

void
copy(int *src, int *dst)
{
    int i;
    for(i = 0; i <= SIZE; i++)
    {
        dst[i] = src[i];
    }
}

int total;

void
move(int *src, int *dst)
{
    total++;
    push(dst, pop(src));
}

void
merge(void)
{
    while(1)
    {
        if(count(s1) == 0 && count(s2) == 0)
        {
            break;
        }
        else if(count(s1) == 0 || (count(s2) > 0 && top(s2) < top(s1)))
        {
            move(s2, s0);
        }
        else
        {
            move(s1, s0);
        }
    }
}

void
reverse(void)
{
    while(1)
    {
        while(count(s2) == 0 || top(s0) == top(s2))
        {
            move(s0, s2);
        }
        if(count(s0) == 0 || top(s2) < top(s0))
        {
            while(count(s2) > 0)
            {
                move(s2, s0);
            }
            break;
        }
        while(count(s0) > 0 && (count(s1) == 0 || top(s0) <= top(s1)))
        {
            move(s0, s1);
        }
        while(count(s2) > 0)
        {
            move(s2, s0);
        }
        merge();
    }
}

void
sort(void)
{
    while(1)
    {
        if(count(s0) == 0)
        {
            merge();
            reverse();
            break;
        }
        else if(count(s1) == 0 || top(s1) >= top(s0))
        {
            move(s0, s1);
        }
        else if(count(s2) == 0 || top(s2) >= top(s0))
        {
            move(s0, s2);
        }
        else
        {
            merge();
        }
    }
}

void
helper(void)
{
    copy(s0, save);
    sort();
    copy(save, s0);
}

int
main(void)
{
    permute(1, 6, helper);
    permute(2, 6, helper);
    permute(3, 6, helper);
    permute(4, 6, helper);
    permute(5, 6, helper);
    permute(6, 6, helper);
    printf("%d\n", permutations);
    printf("%d\n", total);
    return 0;
}

Python: 1,688,293 1,579,182 1,524,054 1,450,842 1,093,195 moves
The main method is main_to_help_best, which is to move some selected elements from main stack to helper stack. It has a flag everything which defines whether we want it to move everything into the specified destination, or whether we want to keep only the largest in destination while the rest in the other helper.
Supposing we are moving to dst using helper helper, the function can roughly be described as follows:

Find the positions of largest elements
Move everything on top of the top-most largest element to helper recursively
Move the largest element to dst
Push back from helper to main
Repeat 2-4 until the largest elements are in dst
a. If everything is set, recursively move elements in main to dst
b. Otherwise, recursively move elements in main to helper

The main sort algorithm (sort2 in my code) will then call main_to_help_best with everything set to False, and then move the largest element back to main, then move everything from the helper back to main, keeping it sorted.
More explanation embedded as comments in the code.
Basically the principles that I used are:

Keep one helper to contain the maximum element(s)
Keep another helper to contain any other elements
Don't do unnecessary moves as much as possible

Principle 3 is implemented by not counting the move if the source is the previous destination (i.e., we just moved main to help1, then we want to move from help1 to help2), and further, we reduce the number of movement by 1 if we are moving it back to the original position (i.e. main to help1 then help1 to main). Also, if the previous n moves are all moving the same integer, we can actually reorder those n moves. So we also take advantage of that to reduce the number of moves further.
This is valid since we know all the elements in the main stack, so this can be interpreted as seeing in the future that we're going to move the element back, we should not make this move.
Sample run (stacks are displayed bottom to top - so the first element is the bottom):

Length 1
Moves: 0
Tasks: 6
Max: 0 ([1])
Average: 0.000

Length 2
Moves: 60
Tasks: 36
Max: 4 ([1, 2])
Average: 1.667

Length 3
Moves: 1030
Tasks: 216
Max: 9 ([2, 3, 1])
Average: 4.769

Length 4
Moves: 11765
Tasks: 1296
Max: 19 ([3, 4, 2, 1])
Average: 9.078

Length 5
Moves: 112325
Tasks: 7776
Max: 33 ([4, 5, 3, 2, 1])
Average: 14.445

Length 6
Moves: 968015
Tasks: 46656
Max: 51 ([5, 6, 4, 3, 2, 1])
Average: 20.748

--------------
Overall
Moves: 1093195
Tasks: 55986
Average: 19.526

We can see that the worst case is when the largest element is placed on the second bottom, while the rest are sorted. From the worst case we can see that the algorithm is O(n^2).
The number of moves is obviously minimum for n=1 and n=2 as we can see from the result, and I believe this is also minimum for larger values of n, although I can't prove it.
More explanations are in the code.
from itertools import product

DEBUG = False

def sort_better(main, help1, help2):
    # Offset denotes the bottom-most position which is incorrect
    offset = len(main)
    ref = list(reversed(sorted(main)))
    for idx, ref_el, real_el in zip(range(len(main)), ref, main):
        if ref_el != real_el:
            offset = idx
            break

    num_moves = 0
    # Move the largest to help1, the rest to help2
    num_moves += main_to_help_best(main, help1, help2, offset, False)
    # Move the largest back to main
    num_moves += push_to_main(help1, main)
    # Move everything (sorted in help2) back to main, keep it sorted
    num_moves += move_to_main(help2, main, help1)
    return num_moves

def main_to_help_best(main, dst, helper, offset, everything=True):
    """
    Moves everything to dst if everything is true,
    otherwise move only the largest to dst, and the rest to helper
    """
    if offset >= len(main):
        return 0
    max_el = -10**10
    max_idx = -1
    # Find the location of the top-most largest element
    for idx, el in enumerate(main[offset:]):
        if el >= max_el:
            max_idx = idx+offset
            max_el = el
    num_moves = 0
    # Loop from that position downwards
    for max_idx in range(max_idx, offset-1, -1):
        # Processing only at positions with largest element
        if main[max_idx] < max_el:
            continue
        # The number of elements above this largest element
        top_count = len(main)-max_idx-1
        # Move everything above this largest element to helper
        num_moves += main_to_help_best(main, helper, dst, max_idx+1)
        # Move the largest to dst
        num_moves += move(main, dst)
        # Move back the top elements
        num_moves += push_to_main(helper, main, top_count)
    # Here, the largest elements are in dst, the rest are in main, not sorted
    if everything:
        # Move everything to dst on top of the largest
        num_moves += main_to_help_best(main, dst, helper, offset)
    else:
        # Move everything to helper, not with the largest
        num_moves += main_to_help_best(main, helper, dst, offset)
    return num_moves

def verify(lst, moves):
    if len(moves) == 1:
        return True
    moves[1][0][:] = lst
    for src, dst, el in moves[1:]:
        move(src, dst)
    return True

def equal(*args):
    return len(set(str(arg.__init__) for arg in args))==1

def move(src, dst):
    dst.append(src.pop())
    el = dst[-1]
    if not equal(dst, sort.lst) and list(reversed(sorted(dst))) != dst:
        raise Exception('HELPER NOT SORTED: %s, %s' % (src, dst))

    cur_len = len(move.history)
    check_idx = -1
    matched = False
    prev_src, prev_dst, prev_el = move.history[check_idx]
    # As long as the element is the same as previous elements,
    # we can reorder the moves
    while el == prev_el:
        if equal(src, prev_dst) and equal(dst, prev_src):
            del(move.history[check_idx])
            matched = True
            break
        elif equal(src, prev_dst):
            move.history[check_idx][1] = dst
            matched = True
            break
        elif equal(dst, prev_src):
            move.history[check_idx][0] = src
            matched = True
            break
        check_idx -= 1
        prev_src, prev_dst, prev_el = move.history[check_idx]
    if not matched:
        move.history.append([src, dst, el])
    return len(move.history)-cur_len

def push_to_main(src, main, amount=-1):
    num_moves = 0
    if amount == -1:
        amount = len(src)
    if amount == 0:
        return 0
    for i in range(amount):
        num_moves += move(src, main)
    return num_moves

def push_to_help(main, dst, amount=-1):
    num_moves = 0
    if amount == -1:
        amount = len(main)
    if amount == 0:
        return 0
    for i in range(amount):
        num_moves += move(main, dst)
    return num_moves

def help_to_help(src, dst, main, amount=-1):
    num_moves = 0
    if amount == -1:
        amount = len(src)
    if amount == 0:
        return 0
    # Count the number of largest elements
    src_len = len(src)
    base_el = src[src_len-amount]
    base_idx = src_len-amount+1
    while base_idx < src_len and base_el == src[base_idx]:
        base_idx += 1

    # Move elements which are not the largest to main
    num_moves += push_to_main(src, main, src_len-base_idx)
    # Move the largest to destination
    num_moves += push_to_help(src, dst, base_idx+amount-src_len)
    # Move back from main
    num_moves += push_to_help(main, dst, src_len-base_idx)
    return num_moves

def move_to_main(src, main, helper, amount=-1):
    num_moves = 0
    if amount == -1:
        amount = len(src)
    if amount == 0:
        return 0
    # Count the number of largest elements
    src_len = len(src)
    base_el = src[src_len-amount]
    base_idx = src_len-amount+1
    while base_idx < src_len and base_el == src[base_idx]:
        base_idx += 1

    # Move elements which are not the largest to helper
    num_moves += help_to_help(src, helper, main, src_len-base_idx)
    # Move the largest to main
    num_moves += push_to_main(src, main, base_idx+amount-src_len)
    # Repeat for the rest of the elements now in the other helper
    num_moves += move_to_main(helper, main, src, src_len-base_idx)
    return num_moves

def main():
    num_tasks = 0
    num_moves = 0
    for n in range(1, 7):
        start_moves = num_moves
        start_tasks = num_tasks
        max_move = -1
        max_main = []
        for lst in map(list,product(*[[1,2,3,4,5,6]]*n)):
            num_tasks += 1
            if DEBUG: print lst, [], []
            sort.lst = lst
            cur_lst = lst[:]
            move.history = [(None, None, None)]
            help1 = []
            help2 = []
            moves = sort_better(lst, help1, help2)
            if moves > max_move:
                max_move = moves
                max_main = cur_lst
            num_moves += moves

            if DEBUG: print '%s, %s, %s (moves: %d)' % (cur_lst, [], [], moves)
            if list(reversed(sorted(lst))) != lst:
                print 'NOT SORTED: %s' % lst
                return
            if DEBUG: print

            # Verify that the modified list of moves is still valid
            verify(cur_lst, move.history)
        end_moves = num_moves - start_moves
        end_tasks = num_tasks - start_tasks
        print 'Length %d\nMoves: %d\nTasks: %d\nMax: %d (%s)\nAverage: %.3f\n' % (n, end_moves, end_tasks, max_move, max_main, 1.0*end_moves/end_tasks)
    print '--------------'
    print 'Overall\nMoves: %d\nTasks: %d\nAverage: %.3f' % (num_moves, num_tasks, 1.0*num_moves/num_tasks)

# Old sort method, which assumes we can only see the top of the stack
def sort(main, max_stack, a_stack):
    height = len(main)
    largest = -1
    num_moves = 0
    a_stack_second_el = 10**10
    for i in range(height):
        if len(main)==0:
            break
        el = main[-1]
        if el > largest: # We found a new maximum element
            if i < height-1: # Process only if it is not at the bottom of main stack
                largest = el
                if len(a_stack)>0 and a_stack[-1] < max_stack[-1] < a_stack_second_el:
                    a_stack_second_el = max_stack[-1]
                # Move aux stack to max stack then reverse the role
                num_moves += help_to_help(a_stack, max_stack, main)
                max_stack, a_stack = a_stack, max_stack
                if DEBUG: print 'Moved max_stack to a_stack: %s, %s, %s (moves: %d)' % (main, max_stack, a_stack, num_moves)
                num_moves += move(main, max_stack)
                if DEBUG: print 'Moved el to max_stack: %s, %s, %s (moves: %d)' % (main, max_stack, a_stack, num_moves)
        elif el == largest:
            # The maximum element is the same as in max stack, append
            if i < height-1: # Only if the maximum element is not at the bottom
                num_moves += move(main, max_stack)
        elif len(a_stack)==0 or el <= a_stack[-1]:
            # Current element is the same as in aux stack, append
            if len(a_stack)>0 and el < a_stack[-1]:
                a_stack_second_el = a_stack[-1]
            num_moves += move(main, a_stack)
        elif a_stack[-1] < el <= a_stack_second_el:
            # Current element is larger, but smaller than the next largest element
            # Step 1
            # Move the smallest element(s) in aux stack into max stack
            amount = 0
            while len(a_stack)>0 and a_stack[-1] != a_stack_second_el:
                num_moves += move(a_stack, max_stack)
                amount += 1

            # Step 2
            # Move all elements in main stack that is between the smallest
            # element in aux stack and current element
            while len(main)>0 and max_stack[-1] <= main[-1] <= el:
                if max_stack[-1] < main[-1] < a_stack_second_el:
                    a_stack_second_el = main[-1]
                num_moves += move(main, a_stack)
                el = a_stack[-1]

            # Step 3
            # Put the smallest element(s) back
            for i in range(amount):
                num_moves += move(max_stack, a_stack)
        else: # Find a location in aux stack to put current element
            # Step 1
            # Move all elements into max stack as long as it will still
            # fulfill the Hanoi condition on max stack, AND
            # it should be greater than the smallest element in aux stack
            # So that we won't duplicate work, because in Step 2 we want
            # the main stack to contain the minimum element
            while len(main)>0 and a_stack[-1] < main[-1] <= max_stack[-1]:
                num_moves += move(main, max_stack)

            # Step 2
            # Pick the minimum between max stack and aux stack, move to main
            # This will essentially sort (in reverse) the elements into main
            # Don't move to main the element(s) found before Step 1, because
            # we want to move them to aux stack
            while True:
                if len(a_stack)>0 and a_stack[-1] < max_stack[-1]:
                    num_moves += move(a_stack, main)
                elif max_stack[-1] < el:
                    num_moves += move(max_stack, main)
                else:
                    break

            # Step 3
            # Move all elements in main into aux stack, as long as it
            # satisfies the Hanoi condition on aux stack
            while max_stack[-1] == el:
                num_moves += move(max_stack, a_stack)
            while len(main)>0 and main[-1] <= a_stack[-1]:
                if main[-1] < a_stack[-1] < a_stack_second_el:
                    a_stack_second_el = a_stack[-1]
                num_moves += move(main, a_stack)
        if DEBUG: print main, max_stack, a_stack
    # Now max stack contains largest element(s), aux stack the rest
    num_moves += push_to_main(max_stack, main)
    num_moves += move_to_main(a_stack, main, max_stack)
    return num_moves

if __name__ == '__main__':
    main()

I don't get your question on 4. What is this storing the second largest element on the second helper? What does that mean?

Basically just keep track of the second largest element in a variable. I guess I was overthinking it. I think it's perfectly fine, haha

"Your function/subroutine can inspect any stack at any time". So if what you are doing can be easily done by running through the stacks and finding the location of the second largest element, it is fine.

Perhaps you can also add a more detailed out-of-code explanation. I still don't understand how this works.

By "inspect any stack at any time" does it mean I can read the stack like an array without consuming any move? That changes everything. Regarding the explanation, I'm still in the process of updating the algorithm (I got it even lower), so I'll update once I'm done.

Read. Only read. It's like the game of Towers of Hanoi, you get to see each element.

I see. That opens up a whole new possibilities and definitely we can reduce the number of moves further. It will make the problem harder though, haha, since the task is then essentially "given an array of integers, find the minimal number of moves to sort it a la Tower of Hanoi". If we're only allowed to see the top of the stack, then my algorithm is close to optimal (if not the optimal)

Java -- 2129090 2083142 moves on 55986 arrays
The ideone link.
The framework to ensure the algorithm is correct:
private final Deque<Integer> main = new ArrayDeque<Integer>();
private final Deque<Integer> help1 = new ArrayDeque<Integer>();
private final Deque<Integer> help2 = new ArrayDeque<Integer>();

private int taskCount = 0;
private int opCount = 0;

private void sort(List<Integer> input) {
    taskCount++;
    main.addAll(input);
    sortMain();
    verify();
    main.clear();
}

private void verify() {
    if (!help1.isEmpty()) {
        throw new IllegalStateException("non-empty help1\n" + state());
    }
    if (!help2.isEmpty()) {
        throw new IllegalStateException("non-empty help2\n" + state());
    }
    int last = 0;
    for (int i: main) {
        if (last > i) {
            throw new IllegalStateException("unsorted main: " + main);
        }
        last = i;
    }
}

private void done() {
    System.out.println();
    System.out.print(opCount + "/" + taskCount);
}

private void move(Deque<Integer> from, Deque<Integer> to) {
    if (from == to) throw new IllegalArgumentException("moving from/to " + from);
    Integer i = from.pop();
    if (to != main && !to.isEmpty() && i > to.peek()) {
        throw new IllegalStateException(
                from + " " + i + " -> " + to);
    }
    to.push(i);
    opCount++;
}

private String name(Deque<Integer> stack) {
    return stack == help1 ? "help1" :
           stack == help2 ? "help2" :
           "main";
}

private String state() {
    return "main:  " + main +
            "\nhelp1: " + help1 +
            "\nhelp2: " + help2;
}

The actual algorithm:
private void ensureMain(Deque<Integer> stack) {
    if (stack != main) {
        throw new IllegalArgumentException("Expected main, got " + name(stack) + "\n" + state());
    }
}

private void ensureHelp(Deque<Integer> stack) {
    if (stack == main) {
        throw new IllegalArgumentException("Expected help, got main\n" + state());
    }
}

private void ensureHelpers(Deque<Integer> stack1, Deque<Integer> stack2) {
    ensureHelp(stack1);
    ensureHelp(stack2);
}

private void sortMain() {
    int height = main.size();
    int topIndex = height;
    while (topIndex == height && height > 1) {
        topIndex = lastIndexOfLargest(height, main);
        height--;
    }
    if (topIndex == height) {
        // is already sorted
        return;
    }
    // split stack at largest element
    int part1Count = topIndex;
    int part2Count = height - topIndex;
    // move largest and first part to help 1
    moveFromMain(part1Count+1, help1, help2);
    // merge both parts to help 2, leaving largest on 1
    mergeToHelp(part2Count, main, part1Count, help1, help2);
    // move largest to main
    move(help1, main);
    // move remaining to main
    moveToMain(height, help2, help1);
}

/** Moves elements from main to helper, sorting them */
private void moveFromMain(int amount, Deque<Integer> target, Deque<Integer> help) {
    if (amount < 1) return;
    ensureHelpers(target, help);
    int topIndex = lastIndexOfLargest(amount, main);
    int part1Count = topIndex;
    int part2Count = amount - topIndex - 1;
    // move first part to help
    moveFromMain(part1Count, help, target);
    // move largest to target
    move(main, target);
    // merge both parts to target
    mergeToHelp(part2Count, main, part1Count, help, target);
}

/** Moves elements from helper to main, keeping them sorted */
private void moveToMain(int amount, Deque<Integer> source, Deque<Integer> help) {
    if (amount < 1) return;
    ensureHelpers(source, help);
    moveHelper(amount-1, source, help);
    move(source, main);
    moveToMain(amount-1, help, source);
}

/** Moves elements between helpers */
private void moveHelper(int amount, Deque<Integer> source, Deque<Integer> target) {
    pushToMain(amount, source);
    popFromMain(amount, target);
}

/** Merges top of main and helper to other helper */
private void mergeToHelp(int mainAmount, Deque<Integer> main, int helpAmount, Deque<Integer> help, Deque<Integer> target) {
    ensureMain(main);
    ensureHelpers(help, target);
    if (mainAmount < 0) mainAmount = 0;
    if (helpAmount < 0) helpAmount = 0;
    while (mainAmount > 0 || helpAmount > 0) {
        // while there is something to merge
        int largestMain = valueOfLargest(mainAmount, main);
        int largestHelp = valueOfLargest(helpAmount, help);
        if (largestMain > largestHelp) {
            // largest is in main
            int index = firstIndexOfLargest(mainAmount, main);
            if (index > 0) {
                // move excess to help:
                int mainTop = index;
                int helpTop = elementsSmallerThan(help, largestMain);
                if (helpTop > 0) {
                    // 1. move top of help to target
                    moveHelper(helpTop, help, target);
                    // 2. merge old top with excess from main
                    mergeToHelp(mainTop, main, helpTop, target, help);
                } else {
                    moveFromMain(mainTop, help, target);
                }
                mainAmount -= mainTop;
                helpAmount += mainTop;
            }
            move(main, target);
            mainAmount--;
        } else {
            // largest is at bottom of help
            int helpTop = helpAmount - 1; // largest is at bottom
            // move top to main
            pushToMain(helpTop, help);
            mainAmount += helpTop;
            // move largest to target
            move(help, target);
            helpAmount = 0;
        }
    }
}

private void pushToMain(int amount, Deque<Integer> from) {
    for (; amount > 0; amount--) move(from, main);
}

private void popFromMain(int amount, Deque<Integer> to) {
    for (; amount > 0; amount--) move(main, to);
}

private int firstIndexOfLargest(int height, Deque<Integer> stack) {
    if (height == 0) throw new IllegalArgumentException("height == 0");
    int topValue = 0;
    int topIndex = 0;
    int i = 0;
    for (Integer e: stack) {
        if (e > topValue) {
            topValue = e;
            topIndex = i;
        }
        if (++i == height) break;
    }
    return topIndex;
}

private int lastIndexOfLargest(int height, Deque<Integer> stack) {
    if (height == 0) throw new IllegalArgumentException("height == 0");
    int topValue = 0;
    int topIndex = 0;
    int i = 0;
    for (Integer e: stack) {
        if (e >= topValue) {
            topValue = e;
            topIndex = i;
        }
        if (++i == height) break;
    }
    return topIndex;
}

private int valueOfLargest(int height, Deque<Integer> stack) {
    int v = Integer.MIN_VALUE;
    for (Integer e: stack) {
        if (height-- == 0) break;
        if (e > v) v = e;
    }
    return v;
}

private int elementsSmallerThan(Deque<Integer> stack, int value) {
    int i = 0;
    for (Integer e: stack) {
        if (e >= value) return i;
        i++;
    }
    return i;
}

The testcase:
public static void main(String[] args) throws Exception {
    HanoiSort hanoi = new HanoiSort();
    int N = 6;
    for (int len = 1; len <= N; len++) {
        Integer[] input = new Integer[len];
        List<Integer> inputList = Arrays.asList(input);
        int max = N;
        for (int i = 1; i < len; i++) max *= N;
        for (int run = 0; run < max; run++) {
            int n = run;
            for (int i = 0; i < len; n /= N, i++) {
                input[i] = (n % N)+1;
            }
            try {
                hanoi.sort(inputList);
            } catch (Exception e) {
                System.out.println(inputList);
                e.printStackTrace(System.out);
                return;
            }
        }
    }
    hanoi.done();
}

C/C++ Didn't measure moves (pegs :p1, p2, p3)
Don't know how to add C++ code that uses STL(formating issue).
Loosing parts of code due to html tag formats in code.

Get n : count of top sorted elements in p1
Do a hanoi move of them (n) to p3 using p2(keeps the sorted property)
Move the next m elems (atleast 1) in reverse order from p1 to p2.
Merge move (n+m) data in p2 & p3 to p1.
     4.1 merge sort p2 & P3 (reverse) to p1
     4.2 move (n+m) to p3
     4.3 hanoi p3 to p1 using p2

Call hanoi sort recursively which will sort atleast n+m+1 elements now.
Stop when n = size of p1.

#include
#include
using namespace std;
/******************************************************************************
   Show the vector (Had to chance cout
*******************************************************************************/

void show(vector p, string msg)
{
   vector::iterator it;
   printf(" %s \n", msg.c_str());
   for(it = p.begin(); it  &fr, vector &inter, vector &to, int n) {
   int d1;
   if (n  &p1, vector &p2, vector &p3) {
   int d3, d2, d1;
   int count,n;
   bool d2_added;

   d2 = p2.back(); p2.pop_back();
   // data will be descending in p1
   d2_added = false;
   while (p3.size() > 0) {
      d3 = p3.back(); p3.pop_back();
      if (d2_added == false && d2  0) {
      d1 = p1.back();p1.pop_back();
      p3.push_back(d1);
      --count;
   }
   //Move back with hanoi from p3 to p1
   // use p2 as inter
   hanoi(p3, p2, p1, n);
}
/*******************************************************************************
   Gets the count of first sorted elements
*******************************************************************************/
int get_top_sorted_count(vector &p1) {
   vector::iterator it;
   int prev = 0;
   int n =1;

   for (it = --p1.end(); it >= p1.begin(); --it){
     if (it == --p1.end()) {
    prev = *it;
        continue;
     }
     if (*it  &p1, vector &p2, vector &p3) {
    int n, d1;
    n = get_top_sorted_count(p1);
    if (n == p1.size()) {
       return;
    }
    hanoi(p1, p2, p3, n);
    p2.push_back(p1.back());
    p1.pop_back();
    merge_move(p1, p2, p3);
    hanoi_sort(p1, p2, p3);
}
/*******************************************************************************
    Sorts baed on hanoi
*******************************************************************************/
int main (void)
{
  vector p1, p2, p3;
  p1.push_back(5);
  p1.push_back(4);
  p1.push_back(7);
  p1.push_back(3);
  p1.push_back(8);
  p1.push_back(2);
  show(p1, "...Bef Sort...");
  hanoi_sort(p1, p2, p3);
  show(p1, "...Aft Sort...");
}

Can you write the code for this? Otherwise, this is not an answer.

I don't see the hanoi(...) function.  Also, you have 2 #includes that don't compile.  Please post the full code.

source: Stack Exchange

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

authors: ДМИТРИЙ МАЛИКОВ

sort: votes


text:
Juggling by Numbers
Your task is to generate a valid juggling pattern by completing a given template. But first, you probably need to know how such a pattern is denoted.

Introduction to Siteswap
Siteswap is the established notation for juggling patterns. It works by dividing the pattern into beats. At each beat your left and right hand alternate at throwing a ball. Each throw (i.e. each beat) is denoted by a number which indicates when that ball is thrown next - this corresponds directly to the height of the throw.
Let's look at some examples. See animations of all of these here.
3-Ball Cascade
The simplest 3-ball pattern. Each ball is thrown at every third beat (alternating hands). Writing out the beats this looks like follows (the ASCII lines connect two beats at which the same ball is thrown):
Beat     1 2 3 4 5 6 7 8 9
Hand     L R L R L R L R L
Siteswap 3 3 3 3 3 3 3 3 3
         └─┼─┼─┘ │ │
           └─┼───┘ │
             └─────┘

Note how every ball thrown at an L beat, is thrown next at an R beat.Siteswap patterns repeat implicitly, so this pattern is usually denoted as 333, although simply 3 would also be sufficient.
441
Here is a slightly more complicated example with the siteswap 441:
Beat     1 2 3 4 5 6 7 8 9
Hand     L R L R L R L R L
Siteswap 4 4 1 4 4 1 4 4 1
         │ │ └─┘ │ │
         └─┼─────┘ │
           └───────┘

Note how even-numbered throws go to the same hand they were thrown from, while odd-numbered throws go to the other hand.
423
Sometimes you just want to hold a ball through a beat instead of throwing it. All that means, that this ball is thrown the next time its this hand's turn - i.e. 2 beats later. So holding a ball is equivalent to a 2 in the pattern:
Beat     1 2 3 4 5 6 7 8 9
Hand     L R L R L R L R L
Siteswap 4 2 3 4 2 3 4 2 3
         │ └─┼─┘ │ │
         │   └───┼─┘
         └───────┘

50505
A 0 means that the current hand is empty at that beat, as this pattern shows:
Beat     1 2 3 4 5 6 7 8 9
Hand     L R L R L R L R L
Siteswap 5 0 5 0 5 5 0 5 0
         └───┼───┼─┘   │
             └───┼─────┘
                 └───────>

Multiplex Juggling
This problem would be a bit too simple with vanilla siteswap though. Enter multiplex patterns! Multiplex juggling means that you throw multiple balls from one hand at the same time. For instance, in the above 3-ball cascade, if you were two throw an additional ball at every third beat, the pattern would become [33]33 and look like this:
Beat     1    2 3 4    5 6 7    8 9
Hand     L    R L R    L R L    R L
Siteswap [33] 3 3 [33] 3 3 [33] 3 3
          └┴──┼─┼──┴┘  │ │
              └─┼──────┘ │
                └────────┘

Here is another example, where the multiplex throw has two different heights/lengths. It could be denoted as either [34]11 or [43]11:
Beat     1    2 3 4    5 6 7    8 9
Hand     L    R L R    L R L    R L
Siteswap [43] 1 1 [43] 1 1 [43] 1 1
          ││  └─┴──┘│  │
          │└────────┘  │
          └────────────┘

(Note that the 1 thrown at beat 2 lands at beat 3 and is immediately thrown again (as another 1) to land at beat 4 and be part of the second multiplex throw.)
The siteswap for the animation at the beginning of this post was [53]15121.
Pattern Validity
For a pattern to be semantically valid the number of balls in a hand must always correspond to the number of throws indicated at that beat. This means, there must be no balls landing at a beat with a 0, there must be only one ball landing at a beat with any other single digit, and there must be n balls landing at a multiplex beat, where n is the number of digits in that multiplex throw. The pattern must also be able to repeat seamlessly.
Examples of invalid patterns are 543 (all balls would land at the same beat), 240 (the 2 would land at the 0 beat) or 33[24] (no ball lands at the multiplex beat, but two balls land at both of the other two beats).
The Challenge
You will take a siteswap pattern which contains wildcards and output a valid pattern, with those wildcards filled in.
Take as input (via stdin, command-line argument, file or function parameter) a string of the format
n s

Where n is an integer indicating the number of balls to be used, and s is a siteswap pattern (without whitespace). You may assume that it is syntactically correct - all square brackets are matched and not nested, and there are no unexpected characters. All throws will be single-digit throws (0 - 9). However, some beats may just be denoted as a _, which is to be filled in with a single or a multiplex throw in the output.
Note: something like [_3] will not be part of the input. Either the entire beat is missing or the entire beat is given.
Output a valid pattern, which can be juggled with the given number of balls and agrees with the input pattern in all the specified beats. If no valid pattern is possible with the given inputs, output !. Output will also be via stdout, to a file or as a function return value.
Note: The output must not contain unnecessary square brackets or zeroes in multiplex throws. So outputs containing [3] or [03] are not accepted, you have to output 3 instead. The order of digits in a multiplex throw is not relevant.
Note: You may omit patterns that are duplicates under cyclic permutations. E.g. for input 3 __ (note the two wildcards), both 42 and 24 are valid answers (among others), but they actually describe the same pattern. You can either output both or just one of them, but you'll have to do it consistently.
This is code golf, the shortest code wins (subject to bonuses listed at the bottom of the question).
You can use JugglingLab to play around with patterns to see if they are valid and what they look like.
Examples
Input           Possible Outputs     Comments

3 _             3
                [21]
                [111]

3 4_3           423

4 4_2           4[51]2
                4[42]2
                4[321]2

3 _23_          6231
                4233
                323[31]
                2235
                223[41]
                0237
                023[43]
                [42]231
                [32]23[11]

4 5_3           !                    5 and 3 will both land at the third beat, but
                                     there is only a single throw at that beat. This
                                     cannot be fixed with any throw in the blank.

2 5_4           !                    Any possible throw in the wildcard (including a
                                     0) will make a pattern for at least 3 balls.

3 54_           !                    The only solution that would correspond to a
                                     3-ball pattern is 540, which is not semantically
                                     valid because the 5 and 4 both land at beat 3.
                                     There are valid solutions, but they require at
                                     least 4 balls.

Bonuses

If your answer can handle "digits" up to 35, denoted by letters (10 = A, 11 = B, ...), subtract 20 characters. You may decide if those letters should be upper-case, lower-case or case-insensitive. (JugglingLab can handle them in lower-case if you want to look at some insane patterns.)
If your answer outputs all valid solutions, subtract 20 characters.

Python, 587 - 20 = 567 chars
from itertools import *
E,J,L,R,X=enumerate,''.join,len,range,list
def f(x):
 [u,p]=str.split(x);n=int(u);a=[[[x],x][type(x)==X]for x in eval("["+J(c if c=="["else"-1,"if c=="_"else c+","for c in p)+"]")];l,w=L(a),[i for i,x in E(a)if x==[-1]]
 for j in product([[0]]+X(chain(*[combinations_with_replacement(R(1,10),i+1)for i in R(n+1)])),repeat=L(w)):
  for k,m in zip(w,j):a[k]=m
  b=[0]*l
  for k,x in E(a):
   for y in x:b[(k+y)%l]+=1
  if all(x==L(y)for x,y in zip(b,a))&((sum(map(sum,a))/l)==n):
   u=0;yield J([['['+J(map(str,x))+']',str(x[0])][L(x)==1]for x in a])
 if u:yield"!"

Just out of curiosity do you happen to know the time complexity of your solution? Don't worry about explaining the algorithm (yet) though, so as not to spoil the fun for others who might still be trying. ;)

I think it is something like L*n^(n*choose(n+11,n+2)) where n is the number of wildcards and L is the number of characters in the pattern. Not exactly efficient.

I just noticed you are over-counting in cases that allow cyclic permutations (e.g. 3 __ has every result twice, with the beats swapped), but I suppose that's rather my fault for not specifying that. I will add a clause though to allow omitting those if that helps saving bytes.

Well, have a bounty then! It seems the question was either too boring or too daunting for everyone else. ;)

authors: ანდრეა გელაშვილი

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


text:
Confuse the Word spell checker!
Your task is to make a program that will take an input of a word of any length, in the Calibri font. This word will be made out of letter characters that are found on a normal QWERTY keyboard. There will be no accents or any other characters (i.e punctuation, numbers etc).
So, the original characters are:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

The program will then scramble it to change the characters so they look similar or exactly the same, which would probably confuse a spell checker by flagging it, but it would confuse me as it looks the same as the normal word, with the unchanged character.
An example of this is the Unicode character U+0430, Cyrillic small letter a ("а"), can look identical to Unicode character U+0061, Latin small letter a, ("a") which is the lowercase "a" used in English.
Another example is the Russian letters а, с, е, о, р, х and у have optical counterparts in the basic Latin alphabet and look close or identical to a, c, e, o, p, x and y.
Rules:

The program has to work out similar characters. This means that they cannot be stored in any form. This means that Unicode value or the character itself.
This is a code golf - the shortest answer wins!
You have to post the ungolfed version too to avoid cheating that can't be detected when its golfed!
You can use any function or program to do this, as long as words are not stored there either.
You must use UTF-8. Other inputs and outputs are banned. This is so that I am actually able to read what you are outputting, and what I am inputting, so I do not have a random mass of squares, question marks and ❮ther rand❮m punctuati❮n!
It has to work with any word that I input.

A working example (Copy and paste this into word and insert a space after, it should flag the second one and not the first one.)
Halim
Hаlim

Some helpful info is here
Good Luck! Begin

I think this is a great candidate for [tag:code-golf] instead of [tag:popularity-contest].

@ProgrammerDan the question with this as code-golf is, how many characters have to be replaced and how dissimilar are they allowed to look for an answer to be valid?

In either case, a definition of "confuse the spell checker" would be nice. Which spell checker? Also, what is our input alphabet? Output alphabet? I recommend that you specify a popular online spell checking tool, and specify an encoding, such as UTF-8.

I've taken your comments on board and changed a few things - thanks for the advice :)

This would have been a great April Fools' prank if I had asked this a few days ago!

Similar to Sort characters by darkness but rather than sorting you're looking for pairs which are quite close in a suitable norm.

@PeterTaylor, its quite different - im confusing people and not sorting by darkness! Also, that never came up in the title box, that title is so obscure!

It's quite similar, in that it's about rendering a font and then examining the pixels. That's going to be the hard part of both tasks in most languages.

I suppose, but this is quite a difficult challenge. Hopefully it will be as popular as create a fork bomb without any memory leaks.

"It has to work with any word that I input." Are you sure the exist homographs for all existing words? Also, any restrictions on the font used? As described in the linked Wikipedia article, some letters are only homographs in certain fonts.

@celtschk. I have updated the question with clarification.

@George Can I have a checkmark?

JavaScript, 71 characters
function f(s){return "\u202E"+s.split("").reverse().join("")+"\u202C";}

Try it out on JSFiddle.
By the way, this would be a good bit shorter in CoffeeScript (53 characters)
f=(s)->"\u202E#{s.split('').reverse().join ''}\u202C"

EDIT: I just noticed that UTF-8 requirement. That's going to be tough in JavaScript. :-/

Don't downvote this answer - its a good one, but it was posted before the rules changed slightly. You also have to input a word and it cant just be hardcoded in. Sorry.

@GeorgeH well the function takes any arbitrary text (not just single words). It's just the JSFiddle that showcases the usage with one specific example.

Oh, Sorry, I've never used JSFiddle before! Its really confused Word now - It thinks George is Egret and other stuff!

Hmm... I randomly picked some words to test your function but it doesn't work... The words I picked were level, rotor, racecar, refer and kayak.

@ace Touché. :P

@ace I could probably fix that by inserting zero-width spaces into palindromes (and hoping that the resulting words are not valid), but that would somehow destroy the elegance of the solution. ^^

Python3 - 51
print(''.join(chr(ord(c)+0xFEE0)for c in input()))

The lazy way!
Slightly ungolfed
r=''
for c in input():
    r += chr(ord(c) - 0x20 + 0xFF00) # convert to fullwidth ASCII range
print(r)

Please can you post an ungolfed version? Thanks!

Done, it should be self explaining :)

If you use it in IDLE you can remove the print() - it'll print it out anyway

You can save one byte by changing the hexadecimal number FEE0 to a decimal number (65248).

Common Lisp, 142
I have no font named Calibri, and most of my fonts lack these symbols, but DejaVu Sans has them. I replace letters with Mathematical Alphanumeric Symbols. The spell checker does not flag any errors. Instead, it fails to detect errors, even if words have obvious typos.
Golfed:
(ignore-errors(do(c)(())(setf c(char-code (read-char)))(write-char(code-char(cond((< 64 c 91)(+ c 120159))((< 96 c 123)(+ c 120153))(t c))))))

Ungolfed:
(ignore-errors      ; Ignore when (read-char) signals end of file.
  (do (c) (())      ; Loop forever with variable c.
    (setf c (char-code (read-char)))
    (write-char
     (code-char
      (cond
         ;; Replace A to Z with U+1D5A0 to U+1D5B9.
         ((< 64 c 91) (+ c 120159))
         ;; Replace a to z with U+1D5BA to U+1D5D3.
         ((< 96 c 123) (+ c 120153))
         ;; Keep other characters.
         (t c))))))

Usage

clisp asconfuse.lisp <in >out
ecl -shell asconfuse.lisp <in >out
sbcl --script asconfuse.lisp <in >out

I assume that your Lisp interpreter has Unicode support and your locale is UTF-8. Do not use abcl, because it has problems outside the Basic Multilingual Plane.
Unix clones: You can run locale in a terminal. If the line for LC_CTYPE does not mention UTF-8, try export LC_CTYPE=en_US.UTF-8.
Example
I pasted some output into LibreOffice. My text has obvious spelling errors, but LibreOffice fails to detect them. It draws no red squiggles under the words, and the spell-check button only reports, "The spellcheck is complete."

The text is, "               ." Firefox also finds no spelling errors in this text.

Dyalog APL, 7 chars
∊''∘,¨

There is a U+FEFF (Zero Width No-Break Space, a.k.a Unicode BOM) between the quotes. This character occurs in in the Calibri font.
The character '' is ∘ prepended , to each ¨ character in the argument, and the whole thing is then flattened ∊.


text:
Unicorn "Miner" CodeGolf
This is a pretty cool CodeGolf challenge in the sense that you're only going to have a limited amount of time to do it. You need to build a program that "mines" StackOverflow unicoins. In order to do this, you need to perform just two HTTP requests. I'm not going to say how, to add to the fun.
The first person to do this gets a -10 on their score. Good luck! Also, if your doing this in JavaScript or similar, you don't need to account for the target browser's XSS, etc. prevention.

Where by "only going to have one day to do it" you mean "it's too late to test if you live anywhere in the Eastern hemisphere"?

@PeterTaylor Yup :) EDIT: lol I fixed it

-1 for unfairness - I already have no access to the Unicoins at the time you posted this challenge.

This question appears to be off-topic because results cannot be reliably tested.

Unicoins are gone, bro

Javascript, 104 (114 chars - 10 bonus)
All due credit here.  Simply posting this to get the "first answer" -10 bonus ;-).
p='$.post("/unicoin/'
setInterval(p+'rock",function(o){'+p+'mine?rock="+o.rock,StackExchange.options.user)})',2e4)

setInterval accepts both functions and strings of code. After susbtituting the variable p, the following gets executed every 20 seconds:
$.post("/unicoin/rock", function(o) {
    $.post("/unicoin/mine?rock=" + o.rock, StackExchange.options.user)
}

Edits are welcome.  I don't know javascript well enough to really competitively golf this.

Save the url in a var ( the /unicoin/ part ) and you shave off some bytes. Also delete all the un-needed whitespace. AND you are using jQuery and you make no references about it. AND reduce the var names. And you should mark it as a community wiki

You can also reduce it by one character by changing the 15 to a one-digit number

It has to be 15 or higher. If its not, it'll give you an interrupted error. What about rounding up to 2e2?

Passing a string of code to setInterval manages to save a bunch of characters. Also, $.post allows to specify a callback function (no need for .done()) and we can include the entire object StackExchange.options.user in the POST request instead of extracting the fkey value from it (which is the single one we actually need).