text:
Unicode UTF Converter
The goal is to create a fully compliant converter between the official Unicode encodings as given in the UTF FAQ. Given that this is centred on Unicode, I will accept the answer with the lowest byte count using the best possible of the involved encodings (which will probably be UTF-8, unless maybe you program it in APL).  I apologize for the long post, but a lot of it is explaining the encodings which can also be accessed in the official specification (pdf, section 3.9 D90 - D92), or Wikipedia.
Specifications
If at any time your language of choice cannot exactly meet a requirement, substitute it with something that sticks the spirit of the rules given. Eg. not every language has built-in arrays, functions etc.

No using string libraries/functions, or encoding libraries/functions. The point of this code golf is to implement the converter using bit/byte manipulation. Using strings themselves in their capacity as a character or byte array is allowed though. Oh, and no OS calls which perform the conversion either.
The converter is a function which will take three parameters: a byte array representing the encoded input string, and the "input" and "output" encodings represented as numbers. Arbitrarily we will assign UTF-8, UTF-16, UTF-16BE, UTF-16LE, UTF-32, UTF-32BE, and UTF32LE numbers from 0 to 6 in that order. There is no need to check if the number is < 0 or > 6, we will assume these parameters are correct. The converter will return a valid byte array in the desired output encoding.
We will use the null character (U+0000) as a string terminator. Anything after this doesn't matter. We will assume that the input array has the null character somewhere so you do not need to do a bounds check.
As per the FAQ, if the input byte array is invalid for its declared encoding, we must signal an error. We will do this in one of the following ways: crash the program, throw an exception, return null or return an array whose first four bytes are all 0 (so that it can be recognized as U+0000 in every encoding).

The Encodings
The official specifications must be followed, but Wikipedia provides a good (and as far as I believe correct) explanation of the encodings, and I will summarize them here for completeness. Note that UTF-16 and UTF-32 have variants for endianness.
UTF-32, UTF-32LE, UTF-32BE
The simplest encoding, each code point is simply encoded in 4 bytes equal to its numeric value. LE/BE represents endianness (little endian/big endian).
UTF-16, UTF-16LE, UTF-16BE
Code points from U+0000 - U+FFFF are encoded in 2 bytes equal to its numeric value. Larger values are encoded using a pair of surrogates which are reserved values from U+D800 - U+DFFF. So to encode points greater than U+FFFF, the following algorithm can be used (shamelessly copied from Wikipedia):

0x010000 is subtracted from the code point, leaving a 20 bit number in the range 0..0x0FFFFF.
The top ten bits (a number in the range 0..0x03FF) are added to 0xD800 to give the first code unit or lead surrogate, which will be in the range 0xD800..0xDBFF [...].
The low ten bits (also in the range 0..0x03FF) are added to 0xDC00 to give the second code unit or trail surrogate, which will be in the range 0xDC00..0xDFFF [...].

UTF-8
Code points from U+0000 - U+007F are encoded as 1 byte equal to its numeric value. From U+0080 - U+07FF they are encoded as 110xxxxx 10xxxxxx, U+0800 - U+FFFF is 1110xxxx 10xxxxxx 10xxxxxx, higher values are 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx. The x's are the bits from the numeric value of the code point.
BOM
The byte-order mark (BOM, U+FEFF) is used as the first code point to indicate endianness. Following the FAQ guidelines on BOMs, the BOM will be used as follows: For UTF-8, UTF-16 and UTF-32 it is optional. If the BOM is absent in UTF-16 or UTF-32, it is assumed to be big endian. The BOM must not appear in UTF-16LE, UTF-16BE, UTF-32LE and UTF-32BE.
Common Pitfalls Causing Invalid UTF
Various things may cause a byte sequence to be invalid UTF.

UTF-8 and UTF-32: Directly encoding surrogate code points ( U+D800 - U+DFFF ), or code points greater than U+10FFFF.
UTF-8: Many invalid byte sequences.
UTF-16: Unpaired, or improperly paired surrogates.
BOM: Must be used as specified in the encoding section. Note that when outputting UTF-16 or UTF-32 (no inherent endianness specified) you can pick, but with little endian, you must include the BOM.

Note that non-characters and unassigned code points (both distinct from surrogates) are to be treated like regular characters.

"No using string libraries/functions, or encoding libraries/functions." What about real built-ins. In APL, ''⎕R''⍠'InEnc' 'UTF16BE' 'OutEnc' 'UTF8-BOM'.

@NBZ Those would not be allowed since the point of this challenge is to implement the behaviour that those provide.

Note to answerers: I had more or less abandoned this question, but given recent renewed interest, in the coming days, I will take some time to go through the answers.

C++, (UTF-8) 971 bytes
#include<cstdint>
using u=uint8_t;using U=uint32_t;U i,o,x,b,m;U R(u*&p){x=*p++;if(!i){m=0;while(128>>m&x)++m;if(m>1)for(x&=127>>m;--m;)x=x<<6|((*p&192)-128?~0:*p++&63);return m?x=~0:x;}else if(i<3){x<<=8;x+=*p++;}else if(i<4){x+=*p++<<8;}else if(i<6){x<<=24;x+=*p++<<16;x+=*p++<<8;x+=*p++;}else{x+=*p++<<8;x+=*p++<<16;x+=*p++<<24;}return x;}U r(u*&p){U x0=R(p);if(i&&i<4&&x>>10==54)x=R(p)>>10==55?(x0<<10)+x-56613888:~0;if(!b++){if(x==65279)if(!i||i%3==1)r(p);else x=~0;else if(x==65534&&i==1)i=3,r(p);else if(x==4294836224&&i==4)i=6,r(p);}return x>1114111||x>>11==27?x=~0:x;}void w(U x,u*&p){if(!o){if(x<128)*p++=x;else{for(m=0;~63<<m&x;m+=6);for(*p++=~127>>m/6|x>>m;m;)*p++=128|x>>(m-=6)&63;}}else if(o<4&&x>65535)x-=65536,w(55296|x>>10,p),w(56320|x&1023,p);else if(o<3)*p++=x>>8,*p++=x;else if(o<4)*p++=x,*p++=x>>8;else if(o<6)*p++=x>>24,*p++=x>>16,*p++=x>>8,*p++=x;else*p++=x,*p++=x>>8,*p++=x>>16,*p++=x>>24;}int t(u*&p,u*&q){for(b=0,x=1;U(x+x);)w(r(p),q);return x;}

The readable program below can be condensed to the above form by filtering it through the following Perl command:
perl -p0 -e 's!//.*!!g;s/\s+/ /g;s/ \B|\B //g;s/0x[\da-f]+/hex($&)/ige;s/#include<[^<>]+>/\n$&\n/g;s/^\n+//mg'

The above command

removes comments
removes unnecessary whitespace
converts hexadecimal literals to decimal
reinstates newlines around #include lines

Readable code
#include <cstdint>
using u = uint8_t;
using U = uint32_t;

U   i,                          // input encoding
    o,                          // output encoding
    x,                          // last read value
    b,                          // char count(BOM only valid when b==0)
    m;                          // temporary variable for measuring UTF-8

//   Encodings:
// 0 UTF-8
// 1 UTF-16
// 2 UTF-16BE
// 3 UTF-16LE
// 4 UTF-32
// 5 UTF-32BE
// 6 UTF-32LE

// Read a character or UTF-16 surrogate
U R(u*& p) {
    x = *p++;
    if (!i) { // UTF-8
        m=0; while (128>>m&x) ++m; // how many bytes?
        if (m>1) for (x&=127>>m; --m; ) x = x<<6 | ((*p&192)-128?~0:*p++&63);
        return m ? x=~0 : x;
    } else if (i<3) { // UTF-16, UTF-16BE
        x<<=8; x+=*p++;
    } else if (i<4) { // UTF-16LE
        x+=*p++<<8;
    } else if (i<6) { // UTF-32, UTF-32BE
        x<<=24; x+=*p++<<16; x+=*p++<<8; x+=*p++;
    } else { // UTF-32LE
        x+=*p++<<8; x+=*p++<<16; x+=*p++<<24;
    }
    return x;
}

// Read a character, combining surrogates, processing BOM, and checking range
U r(u*& p) {
    U x0 = R(p);
    if (i && i<4 && x>>10==54)
        x = R(p)>>10==55 ? (x0<<10)+x-56613888: ~0; // 56613888 == 0xd800<<10 + 0xdc00 - 0x10000
    if (!b++) {                 // first char - is it BOM?
        if (x==0xFEFF)
            if (!i || i%3==1)
                r(p); // BOM in UTF-8 or UTF-16 or UTF-32 - ignore, and read next char
            else
                x = ~0; // not allowed in these modes
        else if (x==0xFFFE && i==1)
            i=3,r(p); // reversed BOM in UTF-16 - change to little-endian, and read next char
        else if (x==0xFFFE0000 && i==4)
            i=6,r(p); // reversed BOM in UTF-32 - change to little-endian, and read next char
    }
    return x>0x10ffff || x>>11==27 ? x=~0 : x;
}

// Write character(assumed in-range)
void w(U x, u*& p) {
    if (!o) { // UTF-8
        if (x<128) *p++=x;        // ASCII
        else {
            for (m=0; ~63<<m&x; m+=6); // how many bits?
            for (*p++=~127>>m/6|x>>m; m; ) *p++ = 128|x>>(m-=6)&63;
        }
    } else if (o<4 && x>65535)  // UTF-16 surrogate
        x-=65536, w(0xD800|x>>10,p), w(0xDC00|x&0x3FF,p);
    else if (o<3)  // UTF-16, UTF-16BE
        *p++=x>>8, *p++=x;
    else if (o<4)  // UTF-16LE
        *p++=x, *p++=x>>8;
    else if (o<6)  // UTF-32, UTF-32BE
        *p++=x>>24, *p++=x>>16, *p++=x>>8, *p++=x;
    else  // UTF-32LE
        *p++=x, *p++=x>>8, *p++=x>>16, *p++=x>>24;
}

// Transcode
int t(u*& p, u*& q)                  // input, output
{
    for (b=0,x=1;U(x+x);)    // exit condition is true only for x==-x, i.e. 0 and ~0
        w(r(p),q);
    return x;
}

The function to be called is t(), with input and output encodings passed in the global variables i and o respectively, and p pointing at the bytes of input, which must be null-terminated.  q points to the output buffer, which will be overwritten, and must be big enough for the result - there is no attempt to avoid buffer overrun.
I hope the code comments are sufficiently explanatory - ask below if one of them is too cryptic (but do make an effort first!).
I compiled a substantial test suite whilst developing this answer; I include it below for the benefit of other entrants, and to document my interpretation of requirements:
Test functions
#include <vector>
#include <iostream>

std::ostream& operator<<(std::ostream& out, const std::vector<u>& v)
{
    out << "{ ";
    for (int i: v) out << i << " ";
    out << "}";
    return out;
}

int test_read(int encoding, std::vector<u> input, U expected)
{
    b = 0;
    i = encoding;
    auto d = input.data();
    U actual = r(d);
    if (actual == expected) return 0;
    std::cerr << std::hex << "Decoding " << encoding << "; " << input << " gave " << actual
              << " instead of " << expected << std::endl;
    return 1;
}

int test_write(int encoding, U input, std::vector<u> expected)
{
    o = encoding;
    u buf[20], *p = buf;
    w(input, p);
    std::vector<u> actual(buf,p);
    if (expected == actual) return 0;
    std::cerr << std::hex << "Encoding " << encoding << "; " << input << " gave " << actual
              << " instead of " << expected << std::endl;
    return 1;
}

int test_transcode(int ienc, std::vector<u> input, int oenc, std::vector<u> expected)
{
    b = 0;
    i = ienc; o = oenc;
    u buf[200], *p = buf, *d = input.data();
    int result = t(d, p);
    std::vector<u> actual(buf,p);
    if (result ? expected.empty() : expected == actual) return 0;
    std::cerr << std::hex << "Encoding " << ienc << " to " << oenc << "; " << input << " gave " << actual
              << " instead of " << expected << std::endl;
    return 1;
}

Test suite
static const U FAIL = ~0;
int main() {
    int e = 0;                        // error count
    // UTF-8
    e += test_read(0, { 128 }, FAIL); // unexpected continuation
    e += test_read(0, { 128, 1 }, FAIL);
    e += test_read(0, { 128, 128 }, FAIL);
    e += test_read(0, { 192, 192 }, FAIL); // start without continuation
    e += test_read(0, { 192, 0 }, FAIL);
    e += test_read(0, { 224, 0 }, FAIL);
    e += test_read(0, { 224, 192 }, FAIL);
    e += test_read(0, { 0xf4, 0x90, 128, 128 }, FAIL); // Unicode maximum+1

    e += test_read(0, { 127 }, 127);
    e += test_read(0, { 192, 129 }, 1); // We accept overlong UTF-8
    e += test_read(0, { 0xc2, 128 }, 128);
    e += test_read(0, { 224, 128, 129 }, 1);
    e += test_read(0, { 0xef, 128, 128 }, 0xF000);
    e += test_read(0, { 0xef, 191, 191 }, 0xFFFF);
    e += test_read(0, { 0xf4, 128, 128, 128 }, 0x100000);
    e += test_read(0, { 0xf4, 0x8f, 191, 191 }, 0x10FFFF); // Unicode maximum

    e += test_read(0, { 0xEF, 0xBB, 0xBF, 127 }, 127); // byte-order mark

    e += test_write(0, 0, { 0 });
    e += test_write(0, 127, { 127 });
    e += test_write(0, 128, { 0xc2, 128 });
    e += test_write(0, 255, { 0xc3, 191 });
    e += test_write(0, 0xFFFF, { 0xef, 191, 191 });
    e += test_write(0, 0x10FFFF, { 0xf4, 0x8f, 191, 191 });

    // UTF-16
    e += test_read(1, { 0, 1 }, 1);
    e += test_read(1, { 0xd8, 0, 0xdc, 1 }, 0x10001);
    e += test_read(1, { 0xdb, 0xff, 0xdf, 0xff }, 0x10ffff);

    e += test_read(1, { 0xd8, 0, 0xd8, 1 }, FAIL); // mismatched surrogate
    e += test_read(1, { 0xd8, 0, 0, 1 }, FAIL); // mismatched surrogate
    e += test_read(1, { 0xdc, 0 }, FAIL);

    e += test_write(1, 1, { 0, 1 });
    e += test_write(1, 256, { 1, 0 });
    e += test_write(1, 0xffff, { 255, 255 });
    e += test_write(1, 0x10001, { 0xd8, 0, 0xdc, 1 });
    e += test_write(1, 0x10ffff, { 0xdb, 0xff, 0xdf, 0xff });

    // UTF-16LE
    e += test_write(3, 1, { 1, 0 });
    e += test_write(3, 256, { 0, 1 });
    e += test_write(3, 0x10001, { 0, 0xd8, 1, 0xdc });
    e += test_write(3, 0x10fffe, { 0xff, 0xdb, 0xfe, 0xdf });

    // UTF-16 byte-order mark
    e += test_read(1, { 0xFE, 0xFF, 0x0, 1 }, 1); // byte-order mark
    e += test_read(1, { 0xFF, 0xFE, 1, 0x0 }, 1); // reversed byte-order mark
    // disallowed byte-order marks
    e += test_read(2, { 0xFE, 0xFF }, FAIL);
    e += test_read(3, { 0xFF, 0xFE }, FAIL);
    // reversed byte-order mark is an unassigned character - to be treated like regular character, according to question
    e += test_read(2, { 0xFF, 0xFE }, 0xfffe);
    e += test_read(3, { 0xFE, 0xFF }, 0xfffe);

    // UTF-32
    e += test_read(4, { 0, 0, 0, 1 }, 1);
    e += test_read(4, { 1, 0, 0, 0 }, FAIL);
    e += test_write(4, 1, { 0, 0, 0, 1 });
    e += test_write(4, 0x10203, { 0, 1, 2, 3 });

    // UTF-32LE
    e += test_read(6, { 0, 0, 0, 1 }, FAIL);
    e += test_read(6, { 1, 0, 0, 0 }, 1);

    // UTF-32 byte-order mark
    e += test_read(4, { 0, 0, 0xFE, 0xFF,  0, 0, 0, 1 }, 1); // byte-order mark
    e += test_read(4, { 0xFF, 0xFE, 0, 0,  1, 0, 0, 0 }, 1); // reversed byte-order mark
    // disallowed byte-order marks
    e += test_read(5, { 0, 0, 0xFE, 0xFF }, FAIL);
    e += test_read(5, { 0xFF, 0xFE, 0, 0 }, FAIL);
    e += test_read(6, { 0, 0, 0xFE, 0xFF }, FAIL);
    e += test_read(6, { 0xFF, 0xFE, 0, 0 }, FAIL);

    e += test_transcode(1, { 1, 2, 0xFE, 0xFF, 0, 0 }, // That's not a BOM; it's a zwnj when not the first char
                        1, { 1, 2, 0xFE, 0xFF, 0, 0 });
    e += test_transcode(1, { 0xFF, 0xFE, 1, 2, 0, 0 }, // reversed byte-order mark implies little-endian
                        1, { 2, 1, 0, 0 });
    e += test_transcode(4, { 0xFF, 0xFE, 0, 0, 1, 2, 0, 0, 0, 0 }, // reversed BOM means little-endian
                        4, { 0, 0, 2, 1, 0, 0, 0, 0 });
    e += test_transcode(1, { 0xdb, 0xff, 0xdf, 0xff, 0, 0 }, // U+10ffff UTF-16 to UTF-8
                        0, { 0xf4, 0x8f, 191, 191, 0 });

    return e;
}

Dang.. C++ beat Python.

@TickTock : while it's technically not "transcoding" per se, my awk entry below  does fully encode UTF-8 and UTF-32 BE+LE, all without needing anything fancy like lambda functions…. on top of not having a single hard-coded number

Python - 1367 UTF-8 chars
Alright! This was an extremely difficult question because of the sheer amount of work it took to understand and implement all the specifications, but I think that I have a correct implementation.
O,P,Q,R=65536,128,b'\xff\xfe\x00\x00',63
def A(x,y):assert x;return y
def B(x):
    o,c=[],0
    for b in x:
        if c:c,v=c-1,A(127<b<192,v<<6)|(b-P)
        else:
            c,v=(b>127)+(b>223)+(b>239),b
            if b>127:v=A(191<b<248,b&(R>>c))
        o+=[v][c:]
    return o[o[0]in(65279,O-2):]
def C(k):
    def o(x,s=None):
        for a,b in zip(x[k::2],x[1-k::2]):
            d=a|(b<<8)
            if s!=None:yield(A(56319<d<57344,d-56320)|(s<<10))+O;s=None
            elif 55295<d<57344:s=A(s<1024,d-55296)
            else:yield d
    return o
def D(x):n=(2,3,1)[[Q[:2],Q[1::-1],x[:2]].index(x[:2])];return C(n&1)(x[n&2:])
E=lambda a,b,c,d:lambda x:[L|(l<<8)|(m<<16) for L,l,m in zip(x[a::4],x[b::4],x[c::4])]
def F(x):n,m=((1,4),(-1,4),(-1,0))[[Q,Q[::-1],x[:4]].index(x[:4])];return E(*range(4)[::n])(x[m:])
S=lambda x,s=0,a=255:(x>>s)&a
G=lambda e:(e,)if e<P else(192|S(e,6),P|(e&R))if e<2048 else(224|S(e,12),P|S(e,6,R),P|(e&R))if e<O else(240|S(e,18),P|S(e,12,R),P|S(e,6,R),P|(e&R))
H=lambda e:(S(e,8),S(e))if e<O else(216|S(e-O,18),S(e-O,10),220+S((e-O)&1023,8),S(e-O))
I=lambda e:(S(e),S(e,8))if e<O else(S(e-O,10),216|S(e-O,18),S(e-O),220+S((e-O)&1023,8))
J=lambda e:(S(e,24),S(e,16),S(e,8),S(e))
K=lambda e:(S(e),S(e,8),S(e,16),S(e,24))
convert=lambda d,i,o:bytes(sum(map(L[o],N(list(M[i](d)))),()))if d else d
L,M=[G,H,H,I,J,J,K],[B,D,C(1),C(0),F,E(3,2,1,0),E(0,1,2,3)]
N=lambda d:[A(-1<x<1114112 and x&~2047!=55296,x)for x in d]

convert is the function that takes the data 'bytes' object, the input ID, and the output ID. It seems to work - although python seems to have a slightly broken usage of BOMs when unspecified in the encoding, so using python's builtin encoding to test modes 1 and 4 won't work.
Fun fact: The size is also 55516 or 101010101012.
773 chars for decoding, 452 for encoding, 59 for verification and 83 for miscellaneous parts.

@TrangOul: Generally, trivial edits (like language tagging) are frowned upon.

@ZachGates someone has to make them whether it be <1000 rep users or >1000 rep users, and that someone is the community

That question/answer doesn't show a community consensus. Across the network, trivial edits like these are frowned upon. Neither <1000 nor >1000 rep users should make these edits unless they clearly improve the content or format. It's best to hold off on editing things like language tags, single word corrections/changes, etc. @cat

I think the size is no longer 0x555 :-(.  But you might get closer using the standard Python-golf tip of using one space for indents.

@TobySpeight it's 0x557 right now, you're right. And actually, I used tabs, which had to be converted to spaces for posting, but still count as one character. I'll go see if I can shave a couple of characters some other way when I get a chance.

In any case, I'm still winning since it's the only response to this question!

"I'm still winning since it's the only response" - no longer!  I'd actually started work on it before you read my comment...

@TobySpeight nice! I suppose I'll have to come back to this at some point soon so that I can get back into first place.

Python 3, 1138 bytes (UTF-8)
So it turns out that 14 hours of international travel is a fantastic opportunity to finish off a golfing challenge...
The conversion function is C(). This calls u(), v(), and w() to decode, and U(), V(), and W() to encode, UTF-8, -16 and -32, respectively. None of the encoders will output a BOM, but all of the decoders will correctly handle one. Error conditions result in an exception (usually a ZeroDivisionError, courtesy of the "die-suddenly" function E()).
from struct import*
l=len
j=''.join
b=lambda c:[*bin(c)[2:]]
P,Q,i,o,z,Z='HI10><'
B=65279
O,F,H,L,X=1024,65536,55296,56320,57344
E=lambda:1/0
R=lambda y,e,c,n:unpack(([[z,Z][y[:n]==pack(Z+c,B)],e][l(e)])+c*(l(y)//n),y)
S=lambda d,e:B!=d[0]and d or e and E()or d[1:]
def u(y,d=(),p=0):
 while p<l(y):
  q=b(y[p])
  if l(q)>7:
   x=q.index(o);C=1<x<5and q[x+1:]or E();X=x+p;X>l(y)>E();p+=1
   while p<X:q=b(y[p]);C=l(q)>7and(i,o==q[:2])and(*C,*q[2:])or E();p+=1
   d=*d,int(j(C),2)
  else:d=*d,y[p];p+=1
 return S(d,0)
def T(p):
 q=b(p);C=()
 while l(q)not in(7,11,16,21):q=o,*q
 while l(q)>6:C=int(i+o+j(q[-6:]),2),*C;q=q[:-6]
 return bytes(p<128and[p]or[int(i*(7-l(q))+o+j(q),2),*C])
U=lambda c:b''.join(map(T,c))
def v(y,e=''):
 c=R(y,e,P,2);d=[];n=0
 while n<l(c)-1:h,a=c[n:n+2];D=[(h,a),(F+(h-H)*O+a-L,)][H<=h<L<=a<X];M=3-l(D);n+=M;d+=D[:M]
 if n<l(c):d=*d,c[n]
 return S(d,e)
V=lambda c,e=z:W(sum(map(lambda p:([H+(p-F)//O,L+(p-F)%O],[p])[p<F],c),[]),e,P)
w=lambda y,e='':S(R(y,e,Q,4),e)
W=lambda c,e=z,C=Q:pack(e+C*l(c),*c)
K=(u,U),(v,V),(v,V,z),(v,V,Z),(w,W),(w,W,z),(w,W,Z)
def C(y,f,t):f,_,*a=K[f];_,t,*b=K[t];return t(f(y,*a),*b)

This ENTIRELY self-contained and POSIX-compliant awk function of my own making, that is

fully-encapsulated with zero external dependencies

can now encode any single Unicode code-point, in both UTF-8 and
UTF-32 (BE+LE), plus any arbitrary byte, regardless of locale-setting (as long as it's not something like EBCDIC). The only part missing is
UTF-16.

is proven working on mawk-1/2, gawk (in any mode other than -t), even nawk (sans "\0" NUL byte), and

doesn't need loops, recursion, pre-made lookups in any shape or form, or caching/memoization

Every single threshold, range cutoff, scaling factor, and necessary offset (like xC0 xE0 xF0 etc), both for the auto-detection part and the encoding part, are being dynamically generated on the fly, while requiring only 1 additional temp variable on top of the 2 needed for user inputs anyway.
My own benchmarking of mawk-2 running it puts it within just 1.7x speed ratio against the built-in encoder in gawk ( 1.0x ), which is a decent showing for a user-level function benchmarked against compiled C-code binaries.

__ is code-point integer input, with auto-detection for out-of-range values such as x < 0, 1114111 < x, plus the UTF-16 surrogate ranges, which would simply print out 1 single arbitrary byte that is its modulo-equivalent.

_ is optional - enter -32 for UTF32-LE or 32 for UTF32-BE;
any other non-empty input, e.g. "1" or "/" or "\t" etc, forces it to use the awk-built-in sprintf("%c", x) single-character encoder, taking the input as-is, and printing out 1 character that will be locale-setting specific
(this feature is most useful when validating against gawk in unicode mode)

.
jot 1114112 0 | mawk 'BEGIN {  }

function chrUC8(__,_,___) {
    return \
    ((___=_)*_)>=(_+=_+=_^=_<_)^_ \
    ? ( (+___<-___)==(___=(--_+_)^_*(_^=++_))^!_ \
        ? sprintf("%c%c%c%c", (__=int(__) % (_*_*_*_))%_+___,
            int(__/_)%_+___, (__=int(__/_/_))%_+___, int(__/_)+___)\
        : sprintf("%c%c%c%c",  int((__%=_*_*_*_)/_/_/_)+___,
            int(__/_/_)%_+___, int(__/_)%_+___,__%_+___)\
                                 ) \
                                 :  +___  ||
          (((__=+__)+__)<_^_ && -__<=+__) ||
      ((___=(--_+_)^_*++_^_)<=__ && __<(_^_*(_+_)+___)) ||
                                  +__<-__ ||
                              ((_+_)^_*(_*_+_^_))<=__\
        ? sprintf("%c",+___<_?__: (__%(_^=_)+_)%_+___)\
    : (__+__)<(_+_)^_                                  \
        ? sprintf("%c%c", (___+=(_*=_*_)+_) +_+ int(__/_), __%_+___) \
    : __<_^(_+_)                                                    \
        ? sprintf("%c%c%c", _*(_+_) + (___+=(_*=_*_)+_) +_+ int(__/_/_),
                                     int(__/_)%_ + ___, __%_ + ___) \
        : sprintf("%c%c%c%c", _*-_+ (___+=(_*=_*_)+_) +_+_+ int(__/_/_/_),
                int(__/_/_)%_ +___, int(__/_)%_ + ___,__%_+___)
}'

The squeezed form is roughly 789 bytes, give or take.
How can this form save space at all ?

e.g. one can write 6 ASCII-bytes of 262144 or 2^18 or even 64^3 to scale 3 continuation bytes in the supplementary planes…

…… or save space via 8^6 or 4^9.

because truth be told, the number 4, and combinations of it, is all you need to encode everything about Unicode :
4
16
256
 #
128
 2048
   65536
      1114112
           ##
           64
           4096
             262144
                 ###
                  128
                   192
                    224
                     240
                      #####
                         1048576
                              2048
                                55296
                                   1024
                                     56320
                                        57344
      # gawk profile,
     created Thu Nov 10 14:26:19 2022

     gawk 'BEGIN {
     1     OFS="\f\b\b"
     1     print "",
     _=4,
     _*_,
     _^_,
     "#",
     _*(_+_)*_,
     _^_*(_+_),
     _^(_+_),
     (_+_)^_*(_^_+_*_),
     "##",
     _*_*_,
     (_+_)^_,
     _^(_+_)*_,
     "###",
     _*(_+_)*_,
     _^_-_*_*_,
     _^_-(_+_)*_,
     _^_-_*_,
     "#####",
     _*_^(_+_)*_,
     _^_*(_+_),
     _^_*(_^_-_-(_+_)*_-_),
     _^_*_,
     _^_*(_^_-(_+_)*_-_),
     (_^_-_*_-_*_)*_^_
}'


text:
So... what is your StackOverflow score?
This is a simple one. Given the input of a number, return the name and reputation score of the Stack Overflow user with that given ID. Your program can assume that it is always given a valid and existent user ID.
For example: given the input 764357 (which is my userID on StackOverflow) the program would return LegoStormtroopr 3,088 (approximately) it might change.
You get the URL: "https://stackoverflow.com/users/" or "http://api.stackexchange.com/2.1/users/" for free, so your score is length of your program - 31 or 39, depending on which URL you use - but declare which it is. This prevents people from abusing URL shorteners.
edit: And no calling a custom made API that query Stack Overflow, and returns just the name and score. But if you know of an offical API, then that is totally legitimate.
edit2: If you need an example input: I've given my ID below, feel free to add your own ID, username and score below to help others out. Note again, this is for the main Stack Overflow site.
764357   returns   LegoStormtroopr 3,088

hmm... if there are multiple users with that rep, should we pick one, or display all of them? What if there is no such user?

uh... wait... of the user with that score, or of the user with that ID?

@JanDvorak I've tried to clarify. The program should accept a user ID, and return the user with that ID, and that users Rep. Score.

The question still says "return the name and reputation score of the Stack Overflow user with that score."

@WolframH Wow, I am dumb and missed that twice. Fixed now. I hope.

Should the url http://api.stackexchange.com/2.1/users/ also be "free" to avoid penalising users of the API?

@gnibbler yes, you can get the official API for free.

Could we get the site=stackoverflow part for free too?

@JohannesKuhn Sure. Why not

Shell script: 64 51 characters
curl -sL http://stackoverflow.com/users/`cat`|grep -oPm2 'n">\K[0-9,]+|e">\K[^<]+'

Sample run:
bash-4.1$ curl -sL http://stackoverflow.com/users/`cat`|grep -oPm2 'n">\K[0-9,]+|e">\K[^<]+'
662504
manatwork
834

bash-4.1$ curl -sL http://stackoverflow.com/users/`cat`|grep -oPm2 'n">\K[0-9,]+|e">\K[^<]+'
764357
Lego Stormtroopr
3,087

(Note that you have to press ^D after typing in the input interactively. Or just pipe it to the command.)

Ruby: 84 70 characters
s=open("http://stackoverflow.com/users/"+gets).read
puts s[/me">(.+)</,1],s[/n">([\d,]+)/,1]

Sample run:
bash-4.1$ ruby -ropen-uri -e 's=open("http://stackoverflow.com/users/"+gets).read;puts s[/me">(.+)</,1],s[/n">([\d,]+)/,1]' <<< '662504'
manatwork
834

bash-4.1$ ruby -ropen-uri -e 's=open("http://stackoverflow.com/users/"+gets).read;puts s[/me">(.+)</,1],s[/n">([\d,]+)/,1]' <<< '764357'
Lego Stormtroopr
3,087

You don't need full words in the regex: s[/me">(.+)</,1],s[/ation".*?([\d,]+)/,1] seems to work

Correct. They were just taken from my shell script answer. (grep would display more matches for just “ation"”.)

@Doorknob, probably you omitted the -ropen-uri option. (It's mandatory and included in the character count.)

@manatwork Ah, didn't notice that. Okay now it works.

Python 2.7 - 119
(150 - 31)
Without regex:
from urllib import*
s=urlopen("http://stackoverflow.com/users/%d"%input()).read()
p=str.split
print p(p(s,'r ')[1],' -')[0],p(p(s,'ore">')[1],'<')[0]

Python 3, 117
117 = 148 - 31
I don't think searching in plain HTML source code will lead to strong solution. For example, some weird stuff in one's profile may break your solutions. So I'd like to search using CSS selectors.
from lxml.html import*
C=parse('http://stackoverflow.com/users/'+input()).getroot().cssselect
print(C('[id^=u]')[0].text,C('[class$=ore]')[0].text)

Javascript 217
Heres a ungolfed Javascript Version using the official api with JSONP, to start with . Using the url would require XHR, which sould be quite verbose, if i find some time i'll try a more golfed version though.
d=document;function f(a){y=a.items[0];alert(y.display_name+" "+y.reputation)}x=d.createElement("script");x.src="https://api.stackexchange.com/2.1/users/"+prompt()+"?site=stackoverflow&callback=f";d.body.appendChild(x)

Perl 5 (with Mojolicious), 87 - 31 = 56 bytes
say/h1.*>(.*)</,$/,/core">(.*?)</ for g("http://stackoverflow.com/users/".pop)->dom

Sample run:
$ perl -Mojo -E 'say/h1.*>(.*)</,$/,/core">(.*?)</ for g("http://stackoverflow.com/users/".pop)->dom' 764357
Lego Stormtroopr
3,103

Readable & clean: 128 - 31 = 97 bytes
say $_->at("#user-displayname")->text, ": ", $_->at(".reputation a")->text for g("http://stackoverflow.com/users/".pop)->dom

Sample run:
$ perl -Mojo -E 'say $_->at("#user-displayname")->text, ": ", $_->at(".reputation a")->text for g("http://stackoverflow.com/users/$ARGV[0]")->dom' 764357
Lego Stormtroopr: 3,103

Is -Mojo included in the count? That costs 4 characters.

@manatwork: No, I did not include it in the count, because the Ruby answer did not include -ropen-uri. However, I am happy to include it if your comment gets a few up votes as indication that the community wants to count these.

Count again. It includes. http://pastebin.com/qZp1QgKa

@manatwork: Oh, I was wrong. The Ruby answer does include -ropen-uri. So I will include it as well, adding 6 chars to both solutions.

Well, I wish we have an exact documentation of the counting rule, but as I know, there is none. One thing is sure: perl's -p option is usually counted +1. Based on that I count -Mojo +4.

@manatwork: OK I see. I am very new to the codegolf site and will edit the answer once again. Thank you.

if parameters to the interp costs nothing, what about -e codehere?

Here's one set of rules we've been using a few times.

R: 150-31=119
f=function(i){S=function(x)strsplit(grep(x,scan(paste0("http://stackoverflow.com/users/",i),"",sep="\n"),v=T)[1],">|<")[[1]][3];cat(S("h1"),S("=re"))}

Quite simply picks the first lines containing h1 (for the name) and =re (for the score) using grep with argument value=TRUE (here v=T) and then split the string (using strsplit at characters > and <. Inconveniently it queries the page twice (hence the two "Read n items" warnings) but that was shorter.
>f(1451109)
Read 917 items
Read 917 items
plannapus 6,566

Tcl, (231 - 39) 192
not the shortest way, but using the official API
package r http
package r json
set d [lindex [dict get [json::json2dict [http::data [http::geturl http://api.stackexchange.com/2.1/users/$argv?site=stackoverflow]]] items] 0]
puts [dict get $d display_name]\ [dict get $d reputation]

And in spirit of the original question:
package r http
package r json
set c [dict get [json::json2dict [http::data [http::geturl http://api.stackexchange.com/2.1/users/?order=desc&sort=reputation&site=stackoverflow&min=$argv&max=$argv]]] items]
foreach d $c {puts "[dict get $d display_name] [dict get $d reputation]"}

Finds users with that reputation

Sorry about that mixup!

@LegoStormtroopr: I wrote this answer when it was clear that you mean the userid, but I liked to show that the official API is able to solve the original question too.

Shorter CoffeeScript: 143 characters (182 - 39)
This relies on the API always returning the object keys in the same order, but shaves off 7 characters.
f=(r)->u=Object.keys(items[0]);alert u[3]+' '+u[5]
d=document
j=d.createElement('script')
j.src="//api.stackexchange.com/2.1/users/"+prompt()+'?site=diy&jsonp=f'
d.body.appendChild j

CoffeeScript: 150 characters (189 - 39)
f=(r)->u=r.items[0];alert u.display_name+' '+u.reputation
d=document
j=d.createElement('script')
j.src="//api.stackexchange.com/2.1/users/"+prompt()+'?site=diy&jsonp=f'
d.body.appendChild j

(Note that the program prompts you for "undefined" -- it's asking for the User ID.)

R - 84
84 = 115 - 31
sub(".*\\/(.*)\\?.*>(.*)<.*","\\1 \\2",grep("b=r",scan(paste0("http://stackoverflow.com/users/",scan(n=1)),""),v=T)[1])

Simulation:
> sub(".*\\/(.*)\\?.*>(.*)<.*","\\1 \\2",grep("b=r",scan(paste0("http://stackoverflow.com/users/",scan(n=1)),""),v=T)[1])
1: 1201032
Read 1 item
Read 2976 items
[1] "flodel 31,093"

+1 This is a very impressive use of regular expressions.

101 100 - CoffeeScript with jQuery
$.getJSON "http://api.stackexchange.com/2.1/users/#{prompt()}?site=stackoverflow",(d)->alert [d.items[0].reputation,d.items[0].display_name]

Here's a fiddle; just know that it prompts you when you first open the page, so have a ID ready, or press Run again.
Or we can be super hacky to save a whole character!
$.getJSON "http://api.stackexchange.com/2.1/users/#{prompt()}?site=stackoverflow",(d)->`with(d.items[0])alert([reputation,display_name])`;1

Python 2.7 - 112
112 = 143 - 31
A newer, short version that uses some of the ideas from Steven Rumbalski answer, while still using Regex.
import urllib,re
r=re.findall('r (.*?) -|re">(.*?)<',urllib.urlopen("http://stackoverflow.com/users/%d"%input()).read())
print r[0][0],r[2][1]

133 = 164 - 31
Here is a base version for people to work from, but I'm sure people can get even shorter.
import urllib,re
u=input()
s=urllib.urlopen("http://stackoverflow.com/users/%d"%u).read()
r=re.findall('name.*?>(.*?)</h1|tion.?>(.*?)</a',s)
print r[0][0],r[1][1]

this doesn't seem to work. http://stackoverflow.com/users/12340 is 404.

@JanDvorak, try with 499214 instead of 12340

@PeterTaylor then the question is incorrect.

@JanDvorak Obviously, the user with that ID doesn't exist.

GNU Awk: 217 characters
Just because GNU awk supports TCP natively: no module/library/external tool.
{RS="\r"
print h("/users/"$0,$0,"/",4),h($2,$2"\\?","<|>",3)}function h(p,m,r,f){d="stackoverflow.com"
g="/inet/tcp/0/"d"/80"
print"GET "p" HTTP/1.1\nHost:"d"\n"|&g
close(g,"to")
while(g|&getline)if($0~m){close(g,"from")
split($0,a,r)
return a[f]}}

Sample run:
bash-4.1$ awk '{RS="\r";print h("/users/"$0,$0,"/",4),h($2,$2"\\?","<|>",3)}function h(p,m,r,f){d="stackoverflow.com";g="/inet/tcp/0/"d"/80";print"GET "p" HTTP/1.1\nHost:"d"\n"|&g;close(g,"to");while(g|&getline)if($0~m){close(g,"from");split($0,a,r);return a[f]}}' <<< 662504
manatwork 854

bash-4.1$ awk '{RS="\r";print h("/users/"$0,$0,"/",4),h($2,$2"\\?","<|>",3)}function h(p,m,r,f){d="stackoverflow.com";g="/inet/tcp/0/"d"/80";print"GET "p" HTTP/1.1\nHost:"d"\n"|&g;close(g,"to");while(g|&getline)if($0~m){close(g,"from");split($0,a,r);return a[f]}}' <<< 764357
lego-stormtroopr 3,947

source: Stack Exchange

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

sort: votes


text:
Convert CP437 to UTF-8
The goal is to read bytes from input encoded in Code Page 437 and output the same characters encoded as UTF-8.  That is, bytes should be translated into Unicode codepoints per this table (a particular revision of the Wikipedia article).  Bytes 0-31 and 127 are to be treated as graphics characters.
Rules
Input and output is via stdin/stdout, or something equivalent to it (only a function that performs the conversion doesn't qualify).  Input is 0 or more bytes before the input stream is closed.
Encoding with UTF-8 is part of the task (as is decoding the input as CP437), so to that end built-in functions or language features that perform conversion between character encodings are not allowed.  Submissions should implement the character encoding conversion themselves.
Scoring is pure code-golf, shortest code wins.  Code length is measured in bytes assuming the source code is encoded using UTF-8.
Example
A byte containing 0x0D received on input, representing '♪', should output bytes 0xE2, 0x99, 0xAA (in that order), which represents codepoint U+266A encoded in UTF-8.
Links

CP437 to Unicode conversion table
Summary of UTF-8 encoding
(Task) Unicode UTF Converter -- for converting between Unicode encodings.

Perl (for example), stores Unicode strings internally as UTF-8, but treats them logically as a sequence of Unicode characters. Does telling Perl to print such strings in their internal presentation (e.g. using the -CO switch) violate the rule against built-in conversion features? Personally, I can see valid arguments either way.

Good question. I think I'd go with "no" since it bypasses the UTF-8 encoding step (and I intended the code doing the encoding to be part of one's solution), but I agree that it's not very obvious with how the rules are currently stated.

Erm, I just noticed didn't pay attention to how the question was formulated.. that'd be a "yes", such a flag does violate the rule (at least in its updated form).

OK, thanks. Another question: if the program is written in Unicode text, is the length measured in characters or in bytes? And can we require that the code be stored in a particular Unicode encoding (specifically, UTF-8), if (or if not) that's the default source code encoding for the language used? Just trying to close (or at least define) the loopholes here...

Thanks, clarified in the task description. Maybe this isn't such an interesting task to golf as I imagined it to be at first...

No, it is not. You need lookup tables (ok, you can probably use logic for a smaller result), and the only challenge is to keep them small.

Tcl, 675
eval [zlib i Ò×sgÆáB\nPÃïÿòpÁ\f0\fv®4\fBc!j¶%cluYbãdÃw¨)+½MB()zàõÍóÝ=\{vÏì®ÿ¢Ö¶\rk×áóUë\tÌÀOÖ)'*ð,ò¦Ì1\[¦y\v?e~oÀÛ\;¼3)ï*S!ïMgÀÜé¬0OVy_sÌÇï©³@ýa>ÀoïæCMl°7ÎG¸«£Æ'º6Ä\"e±³DÆX*#,Ãïd¹êª²Á&ü®Al±!¬Ì,KË³KÓØèÀ*tbU¶cCìÀöÓíc'VcæKl+¬(V\$µÇFI`ãtc#ô`ôbHbS¤°ú°~vã²ôãrìÁÀäD4!í%\$ÕÉcÃ°(E\\®În²vPÁÕ¨âSÃ5ØË°We?nÚ>Ê°1\"ãÄOyÆð»3Ë,²¯d7dº2)\{iÈ=ý|-w3¥\tÈGå(NÖ0ÙÏ1ä¸lpBý\}\t¾e¾E¾i¾<Y£)KCy~ÎÉçe\v2ÆEç¬rYV¸¢ç&¹*»¸¦\;¸.ÃÜ\]ÜnÉ\ ·ñùÄÇóÍ\ ?ãåøæîàÆøf»xEîá%¹WæÞ(¿é_àwíü7Æ:.ó¿3Ã_¸a©,ð·Ìó>Veÿ°\tëtOpxªS<ÃMð\\e/ð7Oñ7ÂÿzÍ4¯pé´lølÕjZÛV¯\]·råk]

Just a simple mapping between input and output. Decompressed it looks like
puts [string map { âº  â»  â¥  â¦  â£  â   â¢  â {  } â {
} â {} â {} â {
} âª  â«  â¼  âº  â  â  â¼  Â¶  Â§  â¬  â¨  â  â  â  â  â  â  â²  â¼  â  Ã  Ã¼  Ã©  Ã¢  Ã¤  Ã   Ã¥  Ã§  Ãª  Ã«  Ã¨  Ã¯  Ã®  Ã¬  Ã  Ã  Ã  Ã¦  Ã  Ã´  Ã¶  Ã²  Ã»  Ã¹  Ã¿  Ã  Ã  Â¢  Â£  Â¥  â§  Æ   Ã¡ ¡ Ã ¢ Ã³ £ Ãº ¤ Ã± ¥ Ã ¦ Âª § Âº ¨ Â¿ © â ª Â¬ « Â½ ¬ Â¼  Â¡ ® Â« ¯ Â» ° â ± â ² â ³ â ´ â¤ µ â¡ ¶ â¢ · â ¸ â ¹ â£ º â » â ¼ â ½ â ¾ â ¿ â À â Á â´ Â â¬ Ã â Ä â Å â¼ Æ â Ç â È â É â Ê â© Ë â¦ Ì â  Í â Î â¬ Ï â§ Ð â¨ Ñ â¤ Ò â¥ Ó â Ô â Õ â Ö â × â« Ø âª Ù â Ú â Û â Ü â Ý â Þ â ß â à Î± á Ã â Î ã Ï ä Î£ å Ï æ Âµ ç Ï è Î¦ é Î ê Î© ë Î´ ì â í Ï î Îµ ï â© ð â¡ ñ Â± ò â¥ ó â¤ ô â  õ â¡ ö Ã· ÷ â ø Â° ù â ú Â· û â ü â¿ ý Â² þ â  ÿ Â } [read stdin]]

The other approach is to use a cp437 -> codepoint table and encode the codepoints yourself, but this would require much more logic.

JavaScript (ES6), 668 bytes
console.log(prompt()[p='replace'](/[\S\s]/g,s=>String.fromCharCode(...(z=`BjuBjvBl1Bl2BkzBkwAciBh4BgrBh5Bk2Bk0Bl6Bl7BjwBgaBgkAmtAd8D2CnBfwAncAmpAmrAmqAmoAqnAmsBg2Bgc${','.repeat(96)}DjB0AhAaAcA8AdAfAiAjAgAnAmAkDgDhDlAeDiAsAuAqAzAxB3DyA4CiCjClAg7,b6A9AlArAyApDtCqD6DbAxcCsD9D8ChCrD7Bf5Bf6Bf7Bb6Bc4GtGuGiGhGvGdGjGpGoGnBbkBboBckBccBbwBb4BcsGqGrGmGgBe1GyGsGcBe4GzBe0GwGxGlGkGeGfBe3Be2BbsBbgBewBesBf0Bf4BeoE9A7FfEoFvErD1EsFyFkE1EcAqmEuEdAqxAshCxAslAskAxsAxtAvArsCwAqhD3AqiAf3CyBfkCg`[p](/G/g,'Bd')[p](/[A-F]/g,s=>','+'745qp6'[s[o='charCodeAt']()%6]).split`,`.map(i=>parseInt(i,36))[s=s[o]()]||s)<(x=128)?[z]:z<2048?[0|192+z/64,x+z%64]:[0|224+z/4096,0|x+z%4096/64,x+z%64])))

prompt()s for input and console.log()s the result. Tested in Firefox, utilises ES6 features of arrow functions, template strings and the spread operator (...). The bulk of the data here is the string which is a comma separated list of base36 numbers that equate to the UTF-8 code points of the characters to update (1-31, 127-255) and pads the other points with empty space/NaNs. The code iterates around each char in the source string, replacing it if necessary. I'm sure it should be possible to shave off more bytes, but I'm done for now! Here's a function for easier testing:
c=t=>t[p='replace'](/[\S\s]/g,s=>String.fromCharCode(...(z=(`BjuBjvBl1Bl2BkzBkwAciBh4BgrBh5Bk2Bk0Bl6Bl7BjwBgaBgkAmtAd8D2CnBfwAncAmpAmrAmqAmoAqnAmsBg2Bgc${','.repeat(96)}DjB0AhAaAcA8AdAfAiAjAgAnAmAkDgDhDlAeDiAsAuAqAzAxB3DyA4CiCjClAg7,b6A9AlArAyApDtCqD6DbAxcCsD9D8ChCrD7Bf5Bf6Bf7Bb6Bc4GtGuGiGhGvGdGjGpGoGnBbkBboBckBccBbwBb4BcsGqGrGmGgBe1GyGsGcBe4GzBe0GwGxGlGkGeGfBe3Be2BbsBbgBewBesBf0Bf4BeoE9A7FfEoFvErD1EsFyFkE1EcAqmEuEdAqxAshCxAslAskAxsAxtAvArsCwAqhD3AqiAf3CyBfkCg`[p](/G/g,'Bd')[p](/[A-F]/g,s=>','+'745qp6'[s[o='charCodeAt']()%6])).split`,`.map(i=>parseInt(i,36))[s=s[o]()]||s)<(x=128)?[z]:z<2048?[0|192+z/64,x+z%64]:[0|224+z/4096,0|x+z%4096/64,x+z%64]))

Run the above and call c() to extract data:
c('\x0d').split('').map(s=>`\\x${s.charCodeAt(0).toString(16)}`).join``
"\xe2\x99\xaa"

JavaScript (ES6), 618 bytes
There is a method in JavaScript for easily converting to source bytes for Unicode chars (that was shared to me by Mathias Bynens on a conversion tool I'd written!) that involves URL encoding and decoding the string which saves bytes, but I feel isn't in the spirit of the original challenge:
console.log(unescape(encodeURIComponent(prompt()[p='replace'](/[\S\s]/g,s=>String.fromCharCode((`BjuBjvBl1Bl2BkzBkwAciBh4BgrBh5Bk2Bk0Bl6Bl7BjwBgaBgkAmtAd8D2CnBfwAncAmpAmrAmqAmoAqnAmsBg2Bgc${','.repeat(96)}DjB0AhAaAcA8AdAfAiAjAgAnAmAkDgDhDlAeDiAsAuAqAzAxB3DyA4CiCjClAg7,b6A9AlArAyApDtCqD6DbAxcCsD9D8ChCrD7Bf5Bf6Bf7Bb6Bc4GtGuGiGhGvGdGjGpGoGnBbkBboBckBccBbwBb4BcsGqGrGmGgBe1GyGsGcBe4GzBe0GwGxGlGkGeGfBe3Be2BbsBbgBewBesBf0Bf4BeoE9A7FfEoFvErD1EsFyFkE1EcAqmEuEdAqxAshCxAslAskAxsAxtAvArsCwAqhD3AqiAf3CyBfkCg`[p](/G/g,'Bd')[p](/[A-F]/g,s=>','+'745qp6'[s[o='charCodeAt']()%6])).split`,`.map(i=>parseInt(i,36))[s=s[o]()]||s)))))

and as a function:
c=t=>unescape(encodeURIComponent(t[p='replace'](/[\S\s]/g,s=>String.fromCharCode(z=(`BjuBjvBl1Bl2BkzBkwAciBh4BgrBh5Bk2Bk0Bl6Bl7BjwBgaBgkAmtAd8D2CnBfwAncAmpAmrAmqAmoAqnAmsBg2Bgc${','.repeat(96)}DjB0AhAaAcA8AdAfAiAjAgAnAmAkDgDhDlAeDiAsAuAqAzAxB3DyA4CiCjClAg7,b6A9AlArAyApDtCqD6DbAxcCsD9D8ChCrD7Bf5Bf6Bf7Bb6Bc4GtGuGiGhGvGdGjGpGoGnBbkBboBckBccBbwBb4BcsGqGrGmGgBe1GyGsGcBe4GzBe0GwGxGlGkGeGfBe3Be2BbsBbgBewBesBf0Bf4BeoE9A7FfEoFvErD1EsFyFkE1EcAqmEuEdAqxAshCxAslAskAxsAxtAvArsCwAqhD3AqiAf3CyBfkCg`[p](/G/g,'Bd')[p](/[A-F]/g,s=>','+'745qp6'[s[o='charCodeAt']()%6])).split`,`.map(i=>parseInt(i,36))[s=s[o]()]||s))))

Tcl, 183
chan con stdin -en cp437
chan con stdout -en utf-8
puts [string map [concat {*}[lmap c [split {☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼} {}] {list [format %c [incr i]] $c}]  ⌂] [read stdin]]

You probably have to setup the input/output in your shell to binary, so it does not mangle the input/output.

I think this probably breaks the prohibition of "built-in functions or language features specifically meant for converting from/to CP437 or UTF-8".

It is not specifically meant for converting from to cp437/utf-8, just any supported encoding. (Much broader usage)

I did mean to prohibit this, but in retrospect I didn't word my rules very well. I wanted to prohibit any built-in mechanics to convert between character encodings, while not prohibiting basicstring manipulation mechanics. I'll try to update the task to reflect this. I do feel a bit bad for changing a task after-the-fact to deny a solution though..

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


text:
Fastest modular exponentiation
The challenge is to write code in any open source, available on linux, language of your choice to perform modular exponentiation. The input will be two randomly chosen 2048 bit positive integers numbers x and y and a 2048 bit prime z.  Here is a sample snippet of python to compare to.
def pow_mod(x, y, z):
    n = 1
    while y:
        if y & 1:
            n = n * x % z
        y >>= 1
        x = x * x % z
    return n

The code should accept a file with each of the three numbers on separate lines and output the result to standard out.  You may not use any libraries for modular exponentiation of course.
The code that runs the fastest on average over 100 runs on my computer wins.
For those who want really accurate timing, the best way may be for the timing code to actually be in the code you provide and for your code to simply repeat 100 times (without cheating :) ). This avoids any problems with start up overheads.

A good solution will probably use some addition-chain or addition-subtraction chain wizardry.  For example (I don't know if this particular approach is good, but...) http://cr.yp.to/ecdh/diffchain-20060219.pdf

Can you give us more info about your computer?

@Ray Ubuntu 64 bit 13.04 on amd fx8350 with 8GB RAM.

C++/asm
Runs in about 7ms on my laptop.  Less than a factor of 2 away from GMP, which is heavily optimized for this task.
Uses Montgomery reduction to compute the modular reductions quickly.  Uses a python script to generate x86 assembly to do the 2048 bit ops (multiply, add, etc.) in great swathes of straightline code.
The code is about 270 lines, a bit big to paste in an answer box.  Download it here.

Haskell
Though it's simple, it should be pretty fast if built with GHC:
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE BangPatterns #-}

module Main where

import Data.Bits

seqI :: Integer -> Integer
seqI x = seq x x

seqB :: Bool -> Bool
seqB x = seq x x

getInteger :: IO Integer
getInteger = fmap (seqI . read) getLine

modExp' :: Integer -> Integer -> Integer -> Integer -> Integer
modExp' r b p m = let nextR = seqI $ mod (seqI $ r*b) m
                      nextB = seqI $ mod (seqI $ b*b) m
                      nextP = seqI $ shiftR  p 1
                      incl  = seqB $ testBit p 0
                      cont  = seqB $ nextP  /= 0
                  in  if incl
                         then if cont
                                 then modExp' nextR nextB nextP m
                                 else nextR
                         else if cont
                                 then modExp' r     nextB nextP m
                                 else r

modExp :: Integer -> Integer -> Integer -> Integer
{-# INLINE modExp #-}
modExp !b !p !m = modExp' 1 b p m

main = do
          b <- getInteger
          p <- getInteger
          m <- getInteger
          print $ modExp b p m

Prime modulus optimization
If the modulus is guaranteed to be a prime, but the exponent might be greater than or equal to the modulus, the last line should be changed to:
          print $ modExp b (mod p (m - 1)) m

Handling multiple inputs
If you'd like it to handle multiple inputs per run, add import System.IO under the other import and the following two lines just under the print line:
          isDone <- isEOF
          if isDone then return () else main

Running
Once it's compiled, it can be run as modexp < file.

I compiled it with ghc -O2. It takes about 0.02 seconds but maybe it makes more sense to have the timing in the code itself.

It might have issues with startup time. I've added a section on how to get it to run, taking 3 lines at a time, all the way until the file ends. You can use cat *.whatever | modexp if you have the test inputs separated into many files.


text:
English numeral calculator
Challenge
Write a calculator that takes input in a verbal form (as one might speak an equation) and also outputs in a verbal form (as one might speak a number).
Rules
The calculator should be able to:

add, subtract, multiply and divide
handle operands between negative one million and one million
handle outputs between negative one billion and one billion
handle decimal points in its input and place them correctly in its output
handle decimal output to the hundredths place, rounding where needed

All operations yielding fractional results should round to the nearest hundredths place (identically to the output formatting).
Report with output "E" (for error) when input would cause the program to fail due to being incorrectly formatted or dividing by 0; basically, the program shouldn't crash on bad input, because that would be a lousy calculator.
The calculator is allowed, but not required to report errors when operands or output escape their bounds.  This is meant to simplify the problem, but if you disagree with me, feel free to make a calculator capable of correctly handling greater operands and outputs without reporting errors.
Output "E" in the event that an operand for an operation exceeds the bounds defined for operands.
Output "E" in the event that the output exceeds the bounds described for outputs
How the program handles case-sensitivity and whitespace are left up to the golfer, as is the choice of British or American English.1
Programs that bypass the implementation of the calculator by using a language or library that has already implemented the functionality described above will be ineligible for victory.
Winner
The program with the lowest number of characters wins.
Examples
Input: two plus two
Output: four
Input: twenty-one point five minus one point five
Output: twenty
Input: one minus two
Output: negative one
Input: five times five
Output: twenty-five
Input: twenty-five divided by five
Output: five
Input: two plus two minus five times five divided by negative zero point five
Output: ten
Input one million times one thousand
Output: one billion
Input: one million times one thousand plus one
Output: E
Input: two million plus one million
Output: E
Input: one million plus one million plus one million
Output: E

What's the order of evaluation you're using? Normally, two plus two minus five times five divided by negative zero point five -> 2 + 2 - 5 * 5 / -0.5 -> 54.

@marinus looks like strictly left-to-right. Thanks for noting

do we have to fail for one million one on the input or one billion one on the output? Also, does the 1e6 limit or the 1e9 limit apply to intermediate results as well?

is the correct output for 1001 one thousand and one, or one thousand one will suffice?

should we consider twelve hundred as must-support input, must-fail input or won't-happen input? What about thirty-six hundred?

In general, is it okay to accept input other than what is specified above, and treat it however one wants? For instance, am I allowed to treat twenteen as an, ahem, nonstandard way of expressing 12?

@FireFly remember you'll have to be able to output twenty correctly. twenteen is never a valid output, so why accept it at input?

@JanDvorak I think it might allow simplifications of the input handling (namely, avoiding a comparison). Regardless, the question still stands whether one has to reject things that aren't proper english words for numerals or operations.

if we take the literal interpretation, then you may accept any input as valid as long as you know it doesn't represent a number outside the valid range.

Are we to use short scale? If that is the case, the test case two million times one million would yield E even without proper operand-magnitude checking (which I'm guessing is what it was meant to test for).

@marinus Jan has it correct, strictly left-to-right; like a normal calculator it does calculations as they are fed in.

@JanDvorak I'm going to say it isn't necessary to fail on anything (input, output, intermediary results) so long as you can deliver the correct output; the purpose of the failure was to make it easier on people to be honest.

@FireFly I'm afraid I'm going to insist on only using proper English words; as Jan's questions are showing, there are already plenty of ambiguities to clarify as is. :)

@FireFly Short scale.  Somebody edited the last two tests for some reason, they should be plus, not times, as they were demonstrating failure on too large input and failure on too large an intermediary value; not that failure is necessary, but if you are going to fail, there's a test for you.

@JanDvorak Either one thousand and one or one thousand one are acceptable, but whichever format is chosen must be handled correctly as input.

@JanDvorak I'm not sure I see the difference between twelve hundred and thirty-six hundred; anyhow, let's call it "won't happen" input, but it is not an error to handle it correctly or to use that style for output.

You talk about supporting decimals but you don't properly specify how they are to be handled. What would the correct output be for one hundred divided by three point nought? (Also, why is the output of the final example E rather than three million?)

@PeterTaylor The final example is E because an intermediary value exceeds the bounds required to be acceptable by the calculator; the second plus is adding two million plus one million.  I admit I hadn't thought about repeating decimals; I suppose "thirty-three point three repeating" would be acceptable to me.

@PeterTaylor Having thought more about the repeating decimals issue, I think it would be best to avoid it by restricting output to the hundredths place; otherwise we get into issues of detecting repeating patterns, which while interesting, is probably a little too much work on top of what is already needed.  The next question then is whether to round output, and the answer is yes.

Are we required to worry about floating-point precision?

@JeffGohlke Let's have each operation's result be rounded to the hundredths place, just like the final output will be.  So "two divided by three times two" will output "one point three four", not "one point three three", because the intermediary .6666 repeating will be rounded to .67 before being multiplied.

Is it acceptable to round half away from zero?

@grc Feel free to pick whatever commonly used tie-breaking method off that page you want, so long as you're rounding to the hundredths place.

First of all, this is totally cheaty, and not complete to the specs.
requires the --disable-web-security flag on chrome, +22
Javascript 509 + 22 = 531
x=new XMLHttpRequest;y=Object.keys(x);b=alert;q="querySelectorAll";s="send";x[y[3]]="document";x.open("GET","http://www.wolframalpha.com/input/?i="+escape(prompt()));x[y[10]]=function(c){4===x.readyState&&(w=[].filter.call(x.response[q](".pod h2"),function(a){return"ame:"==a.innerText.slice(-4)})[0].parentElement,(k=w[q]("a")[0])&&"Words only"==k.innerText?(x.open("GET",k.href),x.send()):alert(JSON.parse([].pop.call(x[y[2]][q]("script")).innerHTML.match(/d_0.00\.push\((.+?)\)/)[1]).stringified))};x[s]()

The first off the spec is as well the example output
The input two plus two minus five times five divided by negative zero point five outputs

Any other case should get handled fine (now), this is yet pretty ungolfed as is, I just wanted it to get fixed.

input: two plus two
output: four

input: twenty-one point five minus one point five
output: twenty

input: one minus two
output: negative one

input: five times five
output: twenty-five

input: twenty-five divided by five
output: five

input: two plus two minus five times five divided by negative zero point five
output: fifty-four

input: one million times one thousand
output: one billion

input: one million times one thousand plus one
output: one billion, one

input: two million plus one million:
output: three million

input: one million plus one million plus one million
output: three million

Oh, and if you actually going to test it, it may take a few seconds, as it loads the complete Wolfram Alpha page up to two times.
Well, there might be a lot to enhance though.

I can't deny that this is an amusing answer, though it is too bad it doesn't provide output in the correct format.  Note that the last two examples also have incorrect output.  Of course, there's also the question of how legitimate this answer is... though I didn't explicitly state that you couldn't query some other pre-existing program, I had meant to convey the idea that the translation from English to number, the calculation, and the translation from number to English, should be implemented by the golfer.  It does pass the literal interpretation of the rules though, I'll give it that. :)

@guest =) I totally, agree with you on that =) It's more of fun answer, beding the rules, than an actual ment codegolf. I'm in the process of fixing the outputs and post a new version. Wolfram Alpha uses images only, took me a while to figure out its stored as a data attribute, b64 encoded.

@guest, updated it. I hope the outputs are now okay =)

If you do this in Mathematica you can control the output to give the correct number decimal places and so on (which is what N would do for fractions): screenshot

+1 for actually being creative with cheating, even though this isn't a [tag:popularity-contest].

Way too late, but this is against the standard loopholes now

Python, 982
from re import*
S=split
U=sub
a=S(' ',U('_','teen ','zero one two three four five six seven eight nine ten eleven twelve thir_four_fif_six_seven_eigh_nine_')+U('_','ty ','twen_thir_for_fif_six_seven_eigh_nine_'))
b=range(20)+range(20,99,10)
d=dict(zip(a,b))
D=dict(zip(b,a))
p='point'
v='negative'
def f(s):
 s=S('[ -]',s);n=0.;m=10**(p in s and(s.index(p)-len(s)))
 for x in s[::-1]:m*=10*(m<1)+100*('hu'in x)+1e3*('ho'in x)+1e6*('m'in x)or 1;n+=(x in d)and m*d[x]
 return n-2*n*(v in s)
def F(n):
 l=[v]*(n<0);x=abs(n)
 for i in(9,6,3,0):z=int(x/10**i);h=z%100;g=(z>99)*[D[z/100],'hundred']+(h>0)*[h in D and D[h]or D[h-z%10]+'-'+D[z%10]];l+=g and g+[[],['thousand'],['million'],['billion']][i/3];x%=10**i
 l+=[c=='.'and p or D[int(c)]for c in'%.2g'%x][n**2>=1:];return' '.join(l)
c=lambda n,l:c(eval(`n`+l[0]+`f(l[1])`),l[2:])if l else n
i=S(' (?=. )|(?<= .) ',U('di.*?y','/',U('times','*',U('minus','-',U('plus','+',raw_input())))))
try:print F(c(f(i[0]),i[1:]))
except:print'E'

I think it works as it should according to the specs, but there are probably a few more bugs. It might act weirdly for input >= one billion or any unexpected words that it interprets incorrectly.
Here's a slightly more readable version with a few changes:
import re
words = re.split(' ', re.sub('_', 'teen ', 'zero one two three four five six seven eight nine ten eleven twelve thir_four_fif_six_seven_eigh_nine_') + re.sub('_', 'ty ', 'twen_thir_for_fif_six_seven_eigh_nine_'))
values = range(20) + range(20, 99, 10)
d = dict(zip(words, values))
D = dict(zip(values, words))

def str_to_num(s):
    s = re.split('[ -]', s)
    n = 0.0
    multiplier = 10 ** ('point' in s and (s.index('point') - len(s)))

    for word in s[::-1]:
        multiplier *= 10 * (multiplier < 1) + 100 * ('hundred' == word) + 1e3 * ('thousand' == word) + 1e6 * ('million' == word) or 1
        n += (word in d) and multiplier * d[word]

    return n - 2 * n * ('negative' in s)

three_digit_num_to_str = lambda n: (n > 99) * [D[n / 100], 'hundred'] + (n % 100 > 0) * [n % 100 in D and D[n % 100] or D[n % 100 - n % 10] + '-' + D[n % 10]]

def num_to_str(n):
    word_list = ['negative'] * (n < 0)
    x = abs(n)

    for i in (9, 6, 3, 0):
        three_digit_str = three_digit_num_to_str(int(x / 10 ** i))
        if three_digit_str:
            word_list += three_digit_str + [[], ['thousand'], ['million'], ['billion']][i / 3]

        x %= 10 ** i

    word_list += [char == '.' and 'point' or D[int(char)] for char in '%.2g' % x][n ** 2 >= 1:]
    return ' '.join(word_list)

calculate = lambda n, l: calculate(eval(str(n) + l[0] + str(str_to_num(l[1]))), l[2:]) if l else n

i = re.split(' (?=. )|(?<= .) ', re.sub('di.*?y', '/', re.sub('times', '*', re.sub('minus', '-', re.sub('plus', '+', raw_input())))))

try:
    print num_to_str(calculate(str_to_num(i[0]), i[1:]))
except:
    print 'E'

There we go.  Golfing the version before broke it, but now we're back online.  I'm positive it can be further golfed.  I'll work on it more tomorrow.  It was hard enough to get it working properly WITHOUT golfing it, though, and my eyes are tired of staring at it.  Haha
Java - 3220
import java.util.*;class a{int D=0,i,l,j;static boolean T=true,F=false;enum O{A("plus"),S("minus"),M("times"),D(""),P("point");String t;O(String u){t=u;}double p(double f,double s){if(this==A)f+=s;if(this==S)f-=s;if(this==M)f*=s;if(this==D)f/=s;return f;}static O f(String s){O r=null;for(O o:values())if(s.equals(o.t))r=o;return r;}}enum N{A("zero",0,F),B("one",1,F),C("two",2,F),D("three",3,F),E("four",4,F),AG("five",5,F),G("six",6,F),H("seven",7,F),I("eight",8,F),J("nine",9,F),K("ten",10,F),L("eleven",11,F),M("twelve",12,F),N("thirteen",13,F),O("fourteen",14,F),P("fifteen",15,F),Q("sixteen",16,F),R("seventeen",17,F),S("eighteen",18,F),AH("nineteen",19,F),U("twenty",20,F),V("thirty",30,F),W("forty",40,F),X("fifty",50,F),Y("sixty",60,F),Z("seventy",70,F),AA("eighty",80,F),AB("ninety",90,F),AC("hundred",100,T),AD("thousand",1000,T),AE("million",1000000,T),AF("billion",1000000000,T);String t;double v;boolean q;N(String u,int w,boolean r){t=u;v=w;q=r;}static N f(String s){N r=null;for(N n:values())if(s.equals(n.t))r=n;return r;}static N f(char s){return d(q(""+s));}static N d(double v){N r=null;for(N n:values())if(v==n.v)r=n;return r;}static String c(double n){return d(n).t;}}public static void main(String[]a){new a();}a(){while(T){try{List p=p(new Scanner(System.in).nextLine()),t=new ArrayList();double d=0;for(j=0;j<p.size();j++){Object o=p.get(j);if(o(o)){if((O)o==O.P){t.add((d(t.get(t.size()-1))+((d=d(p.get(j+1)))<10?d*=100:d<100?d*=10:d)/1000));t.remove(t.size()-2);j++;}else t.add(o);}else {N n=N.d(d(o));if(n!=null&&n.q){t.add((d(o))*d(t.get(t.size()-1)));t.remove(t.size()-2);}else t.add(o);}}double r=d(t.get(0));for(j=1;j<t.size();j++){Object c=t.get(j),l=t.get(j-1);if(o(c))continue;if(c instanceof Double&&l instanceof Double)r+=d(c);else r=((O)t.get(j-1)).p(r,d(t.get(j)));}System.out.println(p(r));}catch(Exception e){System.out.println("E");}}}List p(String s) {List r=new ArrayList();Scanner i=new Scanner(s);while(i.hasNext()){String c=i.next();if(c.equals("divided")){r.add(O.D);i.next();}else if(c.indexOf("-")!=-1){String[] num=c.split("-");r.add(N.f(num[0]).v+N.f(num[1]).v);}else{Object o=N.f(c);r.add(o!=null?((N)o).v:O.f(c));}}return r;}String p(double n){String a=String.valueOf(n),w,d=null,b="";l=a.indexOf(".");if(l!=-1){w=a.substring(0,l);d=a.substring(l+1);}else w=a;if(d.equals("0"))d=null;D=0;while(w.length()%3!=0)w=" "+w;for(i=w.length();i>0;i-=3,D++)b=w(w.substring(i-3,i))+b;return b+d(d);}String w(String w) {if(w==null)return "";w=w.trim();String b="";l=w.length();if(l>1&&w.charAt(l-2)!='0'){if(w.charAt(l-2)=='1')b=N.d(q(w.substring(l-2))).t;else b+=N.d(q(w.charAt(l-2)+"0")).t+"-"+N.f(w.charAt(l-1)).t;}for(j=(b.equals("")?l-1:l-3);j>-1;j--){N n=N.f(w.charAt(j));if(n==N.A)continue;if(j==l-1)b=n.t;else if(j==l-2)b=N.f(n.t+"0")+"-"+b;else if(j==l-3)b=n.t+" hundred "+b;}if(!b.trim().equals("")){if(D==1)b+=" thousand ";if(D==2)b+=" million ";if(D==3)b+=" billion ";}return b;}String d(String d) {if(d==null)return"";if(d.length()>3)d=d.substring(0,3);String b = " point ";for(char n:d.toCharArray())b+=N.f(n).t+" ";return b;}boolean o(Object o){return o instanceof O;}Double d(Object o){return (Double)o;}static double q(String s){return Double.parseDouble(s);}}

With line breaks and tabs
import java.util.*;

class a{

    int D=0,i,l,j;
    static boolean T=true,F=false;

    enum O{
        A("plus"),
        S("minus"),
        M("times"),
        D(""),
        P("point");

        String t;
        O(String u){
            t=u;
        }

        double p(double f,double s){
            if(this==A)f+=s;
            if(this==S)f-=s;
            if(this==M)f*=s;
            if(this==D)f/=s;
            return f;
        }

        static O f(String s){
            O r=null;
            for(O o:values())if(s.equals(o.t))r=o;
            return r;
        }
    }

    enum N{
        A("zero",0,F),
        B("one",1,F),
        C("two",2,F),
        D("three",3,F),
        E("four",4,F),
        AG("five",5,F),
        G("six",6,F),
        H("seven",7,F),
        I("eight",8,F),
        J("nine",9,F),
        K("ten",10,F),
        L("eleven",11,F),
        M("twelve",12,F),
        N("thirteen",13,F),
        O("fourteen",14,F),
        P("fifteen",15,F),
        Q("sixteen",16,F),
        R("seventeen",17,F),
        S("eighteen",18,F),
        AH("nineteen",19,F),
        U("twenty",20,F),
        V("thirty",30,F),
        W("forty",40,F),
        X("fifty",50,F),
        Y("sixty",60,F),
        Z("seventy",70,F),
        AA("eighty",80,F),
        AB("ninety",90,F),
        AC("hundred",100,T),
        AD("thousand",1000,T),
        AE("million",1000000,T),
        AF("billion",1000000000,T);

        String t;
        double v;
        boolean q;

        N(String u,int w,boolean r){
            t=u;
            v=w;
            q=r;
        }

        static N f(String s){
            N r=null;
            for(N n:values())if(s.equals(n.t))r=n;
            return r;
        }

        static N f(char s){
            return d(q(""+s));
        }

        static N d(double v){
            N r=null;
            for(N n:values())if(v==n.v)r=n;
            return r;
        }

        static String c(double n){
            return d(n).t;
        }

    }

    public static void main(String[]a){
        new a();
    }

    a(){
        while(T){
            try{
                List p=p(new Scanner(System.in).nextLine()),t=new ArrayList();
                double d=0;
                for(j=0;j<p.size();j++){
                    Object o=p.get(j);
                    if(o(o)){
                        if((O)o==O.P){
                            t.add((d(t.get(t.size()-1))+((d=d(p.get(j+1)))<10?d*=100:d<100?d*=10:d)/1000));
                            t.remove(t.size()-2);
                            j++;
                        }
                        else t.add(o);
                    }
                    else {
                        N n=N.d(d(o));
                        if(n!=null&&n.q){
                            t.add((d(o))*d(t.get(t.size()-1)));
                            t.remove(t.size()-2);
                        }
                        else t.add(o);
                    }
                }

                double r=d(t.get(0));
                for(j=1;j<t.size();j++){
                    Object c=t.get(j),l=t.get(j-1);
                    if(o(c))continue;
                    if(c instanceof Double&&l instanceof Double)r+=d(c);
                    else r=((O)t.get(j-1)).p(r,d(t.get(j)));
                }

                System.out.println(p(r));
            }
            catch(Exception e){
                System.out.println("E");
            }
        }
    }

    List p(String s) {
        List r=new ArrayList();
        Scanner i=new Scanner(s);
        while(i.hasNext()){
            String c=i.next();
            if(c.equals("divided")){
                r.add(O.D);
                i.next();
            }
            else if(c.indexOf("-")!=-1){
                String[] num=c.split("-");
                r.add(N.f(num[0]).v+N.f(num[1]).v);
            }
            else{
                Object o=N.f(c);
                r.add(o!=null?((N)o).v:O.f(c));
            }
        }
        return r;
    }

    String p(double n){

        String a=String.valueOf(n),w,d=null,b="";

        l=a.indexOf(".");
        if(l!=-1){
            w=a.substring(0,l);
            d=a.substring(l+1);
        }
        else w=a;

        if(d.equals("0"))d=null;

        D=0;
        while(w.length()%3!=0)w=" "+w;

        for(i=w.length();i>0;i-=3,D++)b=w(w.substring(i-3,i))+b;

        return b+d(d);
    }

    String w(String w) {
        if(w==null)return "";
        w=w.trim();

        String b="";
        l=w.length();

        if(l>1&&w.charAt(l-2)!='0'){
            if(w.charAt(l-2)=='1')b=N.d(q(w.substring(l-2))).t;
            else b+=N.d(q(w.charAt(l-2)+"0")).t+"-"+N.f(w.charAt(l-1)).t;
        }

        for(j=(b.equals("")?l-1:l-3);j>-1;j--){
            N n=N.f(w.charAt(j));
            if(n==N.A)continue;
            if(j==l-1)b=n.t;
            else if(j==l-2)b=N.f(n.t+"0")+"-"+b;
            else if(j==l-3)b=n.t+" hundred "+b;
        }

        if(!b.trim().equals("")){
            if(D==1)b+=" thousand ";
            if(D==2)b+=" million ";
            if(D==3)b+=" billion ";
        }

        return b;
    }

    String d(String d) {
        if(d==null)return"";
        if(d.length()>3)d=d.substring(0,3);

        String b = " point ";
        for(char n:d.toCharArray())b+=N.f(n).t+" ";

        return b;
    }

    boolean o(Object o){
        return o instanceof O;
    }

    Double d(Object o){
        return (Double)o;
    }

    static double q(String s){
        return Double.parseDouble(s);
    }

}