text:
The n-th Ternary
I define the n-th ternary as a ternary that returns n and has the form:
1 ? 2 ? 3 ? n - 1 ? n : 0 : 0 : 0  # n - 1 zeroes

Write a function or complete program that given an input n will output or return the n-th ternary. Code-Golf.
Testcases
0 #=> undefined behaviour
1 #=> 1
2 #=> 1 ? 2 : 0
3 #=> 1 ? 2 ? 3 : 0 : 0
10 #=> 1 ? 2 ? 3 ? 4 ? 5 ? 6 ? 7 ? 8 ? 9 ? 10 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0

The 1000-th ternary I think there is some kind of zen harmony to it.

Is trailing whitespace allowed?

@rink no, no training space

@rink.attendant.6 that moment when you realize that you made an embarrassing typo in a comment and you can't edit to correct it... no trailing  spaces

@apsillers Spaces are required as per the test-cases

Since "ternary" means 3, shouldn't you name it the "n-ary", which is what it's referred to in mathematics?

The way to "edit" a comment is: delete it, and add a new one.

@RetoKoradi You can edit a comment if it's within five minutes of posting it.

Pyth - 19 18 17 bytes
The spaces are killing me, thinking of a better way to handle them.
+j" ? "SQ*tQ" : 0

It just joins the numbers by a " ? " and then concatenates the second part on.
+              String concatenation
 j" ? "        Join by the string
  SQ           1-indexed inclusive range to input
 *             String repetition
  tQ           Input - 1
  " : 0        String implicitly closed by end of program

Try it online here.

CJam, 18 18 bytes
ri,:)":?0"*2/ze_S*

Try it online.
Explanation
ri,:)          e# Generate the list 1..n.
":?0"*         e# Insert ":?0" between every two numbers.
2/             e# Split into pairs, e.g. 1:, ?0, 2:, ?0, ..., ?0, n.
z              e# First items in every pair before second items in every pair.
e_             e# Concatenate the two parts.
S*             e# Insert spaces.

I love the :).

Ruby, 31 bytes
f=->n{[*1..n]*' ? '+' : 0'*~-n}

Test:
> f[1]
=> "1"
> f[7]
=> "1 ? 2 ? 3 ? 4 ? 5 ? 6 ? 7 : 0 : 0 : 0 : 0 : 0 : 0"

So array * string == array.join string ... interesting

This is really cool. Out of curiosity, what happens when you do f[0]?

@AlexA. irb(main):007:0> f[0] ArgumentError: negative argument  from (irb):6:in *  from (irb):6:in block in irb_binding  from (irb):7:in []  from (irb):7  from /usr/bin/irb:11:in <main>

@Caridorc Both loud and unintelligible. Nice.

@AlexA. f[0] crashes because it tries to multiply " : 0" with -1 ;) edit: Caridorc beat me to it

@daniero Warning: anti-string may be generated

CJam, 19 bytes
Just a start...
ri_,:)'?*\(":0"*+S*

How it works
ri_                       e# Read the number as integer and make a copy of it on stack
   ,:)                    e# Convert the copy to array [1 .. n]
      '?*                 e# Join the numbers with a '?'. So we have [1 '? 2 '? ... '? n]
         \(               e# Swap the stack to get original integer on top. Decrement it by 1
           ":0"*          e# Get n-1 repeated ":0" string
                +S*       e# Join the two strings and fill it with spaces.

Try it online here

Heck, 1 minute too late.

wow you are pretty fast at coding in Cjam :O

@Dennis I think your initial solution, which was identical to Optimizers's first solution, was actually first. At least I'm pretty sure that I saw it pop up first. But the post time of yours was updated when you edited it within the grace period.

@RetoKoradi his post id is 52870. Mine is 52869 :)

Ah, ok, I don't have permission to see deleted posts on this site. Both must have popped up at the same time for me then, and I only noticed the top one. I do seem to remember that SE might do some funky stuff to post times when editing within the grace period. Otherwise you could post an empty place holder, and fill in the content within the grace period, to make it look like you had the first answer, and it actually contained useful content from the start because edits within the grace period are not tracked.

Brainfuck, 305
(Without input number from STDIN, see edit at the bottom)
-[->+>+<<]>>>++++[>++++++++<-]>[<+>-]+++++++[>+++++++++<-]>[<+>-]++++++[>++++++++
<-]>[<+>-]++<<<<>>>+.-<<<[>.>.<.>>>>>++++++++++<<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<
]>>[-]>>>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]>>[>++++++[-<++++++++>]<.<<
+>+>[-]]<[<[->-<]++++++[->++++++++<]>.[-]]<<++++++[-<++++++++>]<.[-]<<[-<+>]<+<<<
<-]>>-----<<<[->>.>.<.>>.<<<<]

I used this lovely algorithm to print a number, which takes up 155 bytes of the whole program.
It works for inputs up to 32768 (16-bit limitation of the algorithm). It doesn't produce trailing spaces and works for input 1 as well:
input    output
0        [infinite loop (til underflow)]
1        "1"
2        "1 ? 2 : 0"
4        "1 ? 2 ? 3 ? 4 : 0 : 0 : 0"
etc.

Quick walk-through:
Setup (97 bytes)
-                                 Decrease input (position 0)
[->+>+<<]  >>>                    Copy input twice to the right and
                                      shift 3 positions to the right
++++[>++++++++<-]>   [<+>-]       Precalculate number 32 (=" ") at position 3
+++++++[>+++++++++<-]>  [<+>-]    Precalculate number 63 (="?") at position 4
++++++[>++++++++<-]>    [<+>-]    Precalculate number 48 (="0") at position 5
++<<<<                            Precalculate number 2 for later use. This number
                                      will be printed in each iteration. (position 6)

First part (181 bytes)
>>>+.-<<<                Go to the char "0" we saved, increase it, print it,
                             decrease it and go back (this prints "1" everytime)
[                        While our second copy of the number isn't zero
    >.>.<.>>>                Move to " ", print, move to "?", print,
                                 move to " " again, print, move to our
                                 number at the end which is initially 2

    [>>+>+<<<-]>>>[<<<+>>>-]<<+>[<->[>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]
        ++++++++[<++++++>-]>[<<+>>-]>[<<+>>-]<<]>]<[->>++++++++[<++++++>-]]<
        [.[-]<]<             Algorithm to print the number at current position

    +<<<<                    Increase our number at the end and return to the beginning
-]                       Decrease the loop variable

Second part (27 bytes)
>>-----<<<        Move to our "?" char and decrease it by 5 to get ":"
[-                While our first copy of the number isn't zero decrease it
   >>.>.<.>>.<<<<     Print " ", print ":", print " ", print "0"
]

If it would be allowed to map the 8 Brainfuck commands to 3 bits, then this program would take up 114 bytes and another 3 bits
Unary, ~4.08*10^275 bytes
It would be too long for here, but it's just 408452257862560239329948606295286361112603208650130608525040044700379331457759667646985586658469601803889628246410788572492437928714867190270708935427798983714797786123292750743771225096145575210320040188155473030775033228313350778616384531426430459309802833775612506568528463 zeros and works the same as the Brainfuck program.
EDIT: I messed up, this program doesn't take user input really, it just uses the current pointer value as input. For being able to parse a number a whole lot more would be required and I can't be bothered to do that.
So it works with a value directly entered into the program (by appending n times "+" before the program) but not with STDIN

JavaScript (ES6), 42 39 bytes
f=m=>(g=k=>k-m?k+` ? ${g(k+1)} : 0`:m)(1)

The outer function f takes the input value and then calls the inner function g recursively to build the string from the middle out, using the input value as a maximum to test for the base case.
Ungolfed:
function f(max) {
    function g(count) {
        if(count==max) {
            // base case: return max for the center
            return max;
        } else {
            // recursive case: build outer shell around center
            return count + " ? " + g(count+1) + " : 0";
        }
    }

    return g(1);
}

Python 56 55
t=lambda n:' ? '.join(map(str,range(1,n+1)))+' : 0'*~-n

C# - 76
Func<int,string>F=k=>{var r="";for(;k>1;)r=" ? "+k--+r+" : 0";return"1"+r;};

Julia, 44 31 bytes
n->join(1:n," ? ")*" : 0"^(n-1)

This creates an unnamed function that accepts an integer as input and returns a string. To call it, give it a name, e.g. f=n->....
First we join together the integers 1 to n, separating each with ? and spaces into a single string. Then we append to this the string " : 0" repeated n-1 times.
Examples:
julia> f(1)
"1"

julia> f(3)
"1 ? 2 ? 3 : 0 : 0"

julia> f(0)
can't repeat a string -1 times

Haskell, 53 bytes
g n='1':foldr(\x s->" ? "++show x++s++" : 0")""[2..n]

How it works: build the string from inside out by starting with an empty string and looping from n down to 2 with prepending the current number and a ? and appending a : 0. Finally put a 1 in front of all.
A different approach (thanks to @Mauris now 9 bytes shorter):
Haskell, 60 51 bytes
 f n='1':((=<<[2..n])=<<[(" ? "++).show,\x->" : 0"])

How it works: a literal 1 followed by ? <x> for each <x> in [2..n] followed by a constant : 0 for each <x> in [2..n].

An approach based on your 60 bytes that gets down to 51: g n='1':((=<<[2..n])=<<[(" ? "++).show,\x->" : 0"])

Actually, you can get it down to 51 more directly by just replacing (\_->" : 0")=<<[2..n] with [2..n]>>" : 0"

Pyth, 17 bytes
jd.iSQs*RtQ,\?":0

Demonstration.

Perl, 36 bytes
say join(" ? ",1..$_)." : 0"x($_-1)

35 characters +1 for -n.
Run with:
echo 10 | perl -nE'say join(" ? ",1..$_)." : 0"x($_-1)'

Can shave one byte using -p instead of -n and say: Try it online!

Java, 125 88 bytes
Original
String f(int n){if(n==1)return"1";String s="",e="";for(int i=1;i<n;i++){s+=i+" ? ";e+=i==n-1?": 0":": 0 ";}return s+n+" "+e;}

With nicer formatting and variable names:
String nAry(int n) {
    if (n == 1) {
        return "1";
    }
    String start = "", end = "";
    for (int i = 1; i < n; i++) {
        start += i + " ? ";
        end += (i == n - 1) ? ": 0" : ": 0 ";
    }
    return start + n + " " + end;
}

Improved - Thanks to Jack Ammo's comments below:
String f(int n){String s="",e=s;for(int i=1;i<n;){s+=i+++" ? ";e+=" : 0";}return s+n+e;}

you don't need that triadic operator for appending to e just to account for the space, just assume you always need the space on front of the colon e+=" : 0";. You can then save 1 byte by post-incrementing i when it's used instead of on the forloop line for(int i=1;i<n;){s+=i+++" ? ";Your return statement will no longer need the space added after n return s+n+e;. You can also save 1 byte by using e=s. Also, the if statement at the beginning is unnecessary since the for loop logic will guarantee that result anyway.

@JackAmmo Excellent tips, thanks! The if statement was necessary to avoid trailing whitespace, but no longer after your improvements to the for loop logic. I've incorporated the changes and upvoted your answer.

Java, 71
I couldn't help myself after commenting on RCB's answer.  So here's another Java (71 like wow when is Java not the longest!)
String t(int n){String s=""+n;for(;--n>0;)s=n+" ? "+s+" : 0";return s;}

JavaScript ES7, 62 bytes
n=>[for(i of Array(n).keys())i+1].join` ? `+' : 0'.repeat(n-1)

I don't know if I can golf this more. But it's a pretty straightforward solution
Firefox only:

var f=n=>[for(i of Array(n).keys())i+1].join` ? `+' : 0'.repeat(n-1)

alert(f(+prompt('Input: ')));

ES5 equivalent:

// Most browsers now support .repeat
String.prototype.repeat = String.prototype.repeat || function(n){var _n = '', i = 0; for (;i < n; i += 1){_n+=this};return _n}
                                                             //Function
function f(n){a=[];for(i of Array(n).keys()){a.push(i+1)};return a.join(' ? ')+' : 0'.repeat(n-1)}

alert(f(+prompt('Input: ')))

CoffeeScript, 52 bytes
f=(n)->s='';s=' ? '+n--+s+' : 0'while n;s.slice 3,-4

Explanation
f=(n)->
 s = ''                                # initialize string
 s = ' ? ' + n-- + s + ' : 0' while n  # prepend and append in decrementing loop
 s.slice 3,-4                          # chop off leading ?, trailing 0 and whitespace

SWI-Prolog, 90 bytes
a(X):-Y is X-1,\+ (between(1,Y,L),\+writef('%w ? ',[L])),write(X),writef('%r',[' : 0',Y]).

Definitely not going to win, but the \+ (between(1,TopBound,N),\+do_something(N)) construction is pretty interesting to repeat something on a sequence of integers.

Swift 145 (135 w/o whitespace)
func t(n:Int) -> String {
    let a = (1..<n).reverse().reduce("") {" ? \($1)\($0) : 0"}
    return a.substringFromIndex(advance(a.startIndex, 3))
}

Can you believe the part to substring is actually longer than the part to produce the expression.

Gotta love Swift <3 I really wish though that they make it so you can access Strings with Integer indices like str[1] or str[0...5]. Of course you can make a small extension, but I wish the standard library enabled this

@Kametrixom apple once allowed this in the first beta, but the various unicode encodings prevent you from doing so. That's mainly because some symbols are two bytes or more long and some are not. So it is not guaranteed to fetch the same character in different encodings with the same index. My description may not be accurate, but that's basically why apple introduced the ugly mouthful string index syntax.

Recently I've really gotten used to use Swift for Code Golfing, have a look at my Swift answer

Objective-C, 346 bytes
-(void)printTernaryOfInt:(int)ternary{NSMutableString *outString=@"".mutableCopy; for (int i=1;i<=ternary;i++) {[outString appendString:[NSString stringWithFormat:@" ? %i",i]];}[outString deleteCharactersInRange:NSMakeRange(0, 2)];for (int i=1;i<ternary;i++) {[outString appendString:[NSString stringWithFormat:@" : 0"]];}NSLog(@"%@",outString);}

Putting in 0 for the int or anything negative raises an NSRangeException due to outString containing nil. This should run on iOS 2.0 and later and many of the latest versions of Mac OS X.
A breakdown of the code:
-(void)printTernaryOfInt:(int)ternary{ ... }

Standard function declaration in Objective-C.
NSMutableString *outString=@"".mutableCopy;

Makes a string for output to go to, outString, and makes it mutable. (In other words, it can be read and written to.
for (int i=1;i<=ternary;i++) {[outString appendString:[NSString stringWithFormat:@" ? %i",i]];}

Adds the first part of the string to output.
[outString deleteCharactersInRange:NSMakeRange(0, 2)];

Cleans up the beginning of the string to make sure ? 1 is replaced with 1. Note: if 0 was given, this is where the NSRangeException would occur, due to there not being an index 1.
for (int i=1;i<ternary;i++) {[outString appendString:[NSString stringWithFormat:@" : 0"]];}

Adds the second part of the string to the string.
NSLog(@"%@",outString);}

Spits the string back out using NSLog and closes off the function.
Output:
Inputting 0 gives this crash log:
    2015-07-11 05:15:28.036 Example App[41665:2134488] *** Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFString deleteCharactersInRange:]: Range or index out of bounds'
*** First throw call stack:
(
    0   CoreFoundation                      0x009b5746 __exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x0063ea97 objc_exception_throw + 44
    2   CoreFoundation                      0x009b566d +[NSException raise:format:] + 141
    3   CoreFoundation                      0x00981813 mutateError + 259
    4   CoreFoundation                      0x009818c1 -[__NSCFString deleteCharactersInRange:] + 65
    5   Example App                         0x000e3785 -[ViewController printTernaryOfInt:] + 277
    6   Example App                         0x000e3645 -[ViewController placeOrder:] + 133
    7   libobjc.A.dylib                     0x006547cd -[NSObject performSelector:withObject:withObject:] + 84
    8   UIKit                               0x00d75a40 -[UIApplication sendAction:to:from:forEvent:] + 99
    9   UIKit                               0x00d759d2 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 64
    10  UIKit                               0x00eb613a -[UIControl sendAction:to:forEvent:] + 69
    11  UIKit                               0x00eb6557 -[UIControl _sendActionsForEvents:withEvent:] + 598
    12  UIKit                               0x00eb57c1 -[UIControl touchesEnded:withEvent:] + 660
    13  UIKit                               0x00dcdcaa -[UIWindow _sendTouchesForEvent:] + 874
    14  UIKit                               0x00dce786 -[UIWindow sendEvent:] + 792
    15  UIKit                               0x00d8c681 -[UIApplication sendEvent:] + 242
    16  UIKit                               0x00d9cab8 _UIApplicationHandleEventFromQueueEvent + 21484
    17  UIKit                               0x00d702e7 _UIApplicationHandleEventQueue + 2300
    18  CoreFoundation                      0x008d706f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
    19  CoreFoundation                      0x008ccb7d __CFRunLoopDoSources0 + 253
    20  CoreFoundation                      0x008cc0d8 __CFRunLoopRun + 952
    21  CoreFoundation                      0x008cba5b CFRunLoopRunSpecific + 443
    22  CoreFoundation                      0x008cb88b CFRunLoopRunInMode + 123
    23  GraphicsServices                    0x029e42c9 GSEventRunModal + 192
    24  GraphicsServices                    0x029e4106 GSEventRun + 104
    25  UIKit                               0x00d740b6 UIApplicationMain + 1526
    26  Example App                         0x000e3cfa main + 138
    27  libdyld.dylib                       0x02d76ac9 start + 1
    28  ???                                 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

1 gives this:
2015-07-11 05:06:02.360 Example App[41665:2134488]  1

2 gives this:
2015-07-11 05:06:07.613 Example App[41665:2134488]  1 ? 2 : 0

7 gives this:
2015-07-11 05:06:12.147 Example App[41665:2134488]  1 ? 2 ? 3 ? 4 ? 5 ? 6 ? 7 : 0 : 0 : 0 : 0 : 0 : 0

200 gives this:
2015-07-11 05:06:35.552 Example App[41665:2134488]  1 ? 2 ? 3 ? 4 ? 5 ? 6 ? 7 ? 8 ? 9 ? 10 ? 11 ? 12 ? 13 ? 14 ? 15 ? 16 ? 17 ? 18 ? 19 ? 20 ? 21 ? 22 ? 23 ? 24 ? 25 ? 26 ? 27 ? 28 ? 29 ? 30 ? 31 ? 32 ? 33 ? 34 ? 35 ? 36 ? 37 ? 38 ? 39 ? 40 ? 41 ? 42 ? 43 ? 44 ? 45 ? 46 ? 47 ? 48 ? 49 ? 50 ? 51 ? 52 ? 53 ? 54 ? 55 ? 56 ? 57 ? 58 ? 59 ? 60 ? 61 ? 62 ? 63 ? 64 ? 65 ? 66 ? 67 ? 68 ? 69 ? 70 ? 71 ? 72 ? 73 ? 74 ? 75 ? 76 ? 77 ? 78 ? 79 ? 80 ? 81 ? 82 ? 83 ? 84 ? 85 ? 86 ? 87 ? 88 ? 89 ? 90 ? 91 ? 92 ? 93 ? 94 ? 95 ? 96 ? 97 ? 98 ? 99 ? 100 ? 101 ? 102 ? 103 ? 104 ? 105 ? 106 ? 107 ? 108 ? 109 ? 110 ? 111 ? 112 ? 113 ? 114 ? 115 ? 116 ? 117 ? 118 ? 119 ? 120 ? 121 ? 122 ? 123 ? 124 ? 125 ? 126 ? 127 ? 128 ? 129 ? 130 ? 131 ? 132 ? 133 ? 134 ? 135 ? 136 ? 137 ? 138 ? 139 ? 140 ? 141 ? 142 ? 143 ? 144 ? 145 ? 146 ? 147 ? 148 ? 149 ? 150 ? 151 ? 152 ? 153 ? 154 ? 155 ? 156 ? 157 ? 158 ? 159 ? 160 ? 161 ? 162 ? 163 ? 164 ? 165 ? 166 ? 167 ? 168 ? 169 ? 170 ? 171 ? 172 ? 173 ? 174 ? 175 ? 176 ? 177 ? 178 ? 179 ? 180 ? 181 ? 182 ? 183 ? 184 ? 185 ? 186 ? 187 ? 188 ? 189 ? 190 ? 191 ? 192 ? 193 ? 194 ? 195 ? 196 ? 197 ? 198 ? 199 ? 200 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0

C, 84 78 bytes
C, even though it is not the shortest, as a function:
i;f(n){while(++i<n)printf("%i ? ",i);printf("%i",n);while(--i)printf(" : 0");}

In the name of golfing, the int type specifier is left off of i, f, and n because it is the default.  i can be uninitialized because it is a global variable and defaults to zero.  f does not return a value, but that only causes a warning.  printf is not #include'd.  To run, here is a full program version:
#include <stdio.h>

i;f(n){while(++i<n)printf("%i ? ",i);printf("%i",n);while(--i)printf(" : 0");}

int main(int argc, char *argv[]){
    if(argc != 2){
        return 1;
    }
    f(atoi(argv[1]));
    puts("");
}

You may be able to shorten this by using for(printf(...);--i;).

C, 63 bytes
Reusable function, takes n as an argument.
i;f(n){for(i=1;i<2*n;i++)printf(i-1?n/i?" ? %d":" : 0":"1",i);}

Ungolfed and commented (pretty straightforward):
int f(int n) {
    int i;

    // 1 ... n, n+1 ... 2n-1
    for(i = 1; i < 2*n; i++) {
        // If i == 1, prints "1"
        // If i <= n, prints " ? %d", i (i = 2 ... n)
        // Else, prints " : 0" (i = n+1 ... 2n-1)
        printf(
            i-1 ?
                n/i ?
                    " ? %d" :
                    " : 0" :
                "1",
        i);
    }
}

Common Lisp, 84
(format t "~{~A ? ~}~@*~{~[~;~:;0~^ ? ~]~}" (loop for i from 1 to (read) collect i))

First, (loop for i from 1 to (read) collect i) generates a list of integers from 1 to whatever is put in, which is used as the only argument to the function. But the real magic of it is in the control string that looks like line noise. "~{~A ? ~}" iterates over the entire list stored within the first argument, outputting each number with the ? for the first half. ~@* resets the argument list to the first argument. ~{~[~;~:;0~^ ? ~]~} reiterates over the list, outputting 0 ? for each argument consumed, but outputting nothing if the argument is 0 or 1.

JavaScript (ES6), 59 bytes
Same approach as my CoffeeScript answer, using template strings help. String.prototype.repeat costs too many characters.
f=n=>{for(s=``;n;)s=` ? ${n--+s} : 0`;return s.slice(3,-4)}

Demo
Firefox only for now, as it is ES6.

f=n=>{for(s=``;n;)s=` ? ${n--+s} : 0`;return s.slice(3,-4)}

// DEMO
console.log = x => document.body.innerHTML += '<p>' + x

console.log(f(1));
console.log(f(3));
console.log(f(10));

Python 2, 63 60 58 56
Try it here
Easy solution: (63)
n=input()
for i in range(n-1):print-~i,'?',
print`n`+' : 0'*~-n

Edit: I really wanted to try a recursive function. Here it is: (56)
f=lambda n,c=1:`c`+(' ? '+f(n,c+1)if c<n else~-n*' : 0')

Edit: Anyone know why this isn't working? I tried a list with an index of c<n, but that didn't work because of a stack overflow error. Same with this:
f=lambda n,c=1:`c`+((c<n)*(' ? '+f(n,c+1))or~-n*' : 0')

The index doesn't work because it has to create a list containing the evaluated function (which obviously would run forever). The same thing happens with your multiplication, it still needs to evaluate the function even though it is doing 0* it.

@FryAmTheEggman Alright, thanks. I've never had a situation like this occur before.

K, 36 bytes
{(3_,/(" ? ",)'$!x),(4*-1+x)#" : 0"}

Swift, 79 75 bytes
let f={{$0+$1}((1..<$0).reduce(("1","")){($0.0+" ? \($1+1)",$0.1+" : 0")})}

f is implicitly declared as a function with one Int parameter which returns a String
Works with n >= 1 and crashes at runtime when n == 0. There are no trailing whitespaces
Edit: Managed to remove 2*2 characters, because string interpolation isn't always the shortest
Note to edit: This code takes forever (it doesn't stop) to compile, but it definitely would if the compiler would be able to handle it. Take a look at the version before this edit to get one that compiles

rs, 77 bytes
(\d+)/(_)^^(\1)
+^_(_+)/\1 _\1
_(_+)$/_\1( : 0)^^((^^\1))
(__+)/? (^^\1)
^./1

Live demo and test cases.
Explanation:
(\d+)/(_)^^(\1)

Expand the number into a series of N underscores.
+^_(_+)/\1 _\1

Repeatedly create a range of underscores, separated by spaces. e.g. This would turn ___ into _ __ ___.
_(_+)$/_\1( : 0)^^((^^\1))

Append to the last set of underscores (of length N) N-1 instances of  : 0.
(__+)/? (^^\1)

Replace each group of underscores by it's length, preceded by ?, EXCEPT for the first one.
^./1

Replace the first one with the number 1.
Because of the format, this also handles 0 well: it just prints the empty string.

><>, 32 + 3 = 35 bytes
:l(?vln" ? "ooo0$
"ooo>nl?!;" :

Note that there is a trailing space on the second line.
The +3 is for the -v flag, e.g. run like
$ py -3 fish.py ternary.py -v 2
1 ? 2 : 0

Taking input as a code point like
i:l(?vln" ? "ooo0$!
 "ooo>nl?!;" :

is 34 bytes, but I prefer the above version since it's easier to test and it won't win anyway.
Explanation
There's quite a bit of pseudo-recursion and abuse going on, so let's take a look.
The first line prints the "1 ? 2 ? ... n-1 ? "  part. The stack starts off with just the input n, thanks to the -v flag, and we do the following:
:l(?v           If (length of stack + 1 > n), go to the second line
ln              Print the length of the stack
" ? "ooo        Print the reverse of " ? " (but hey, palindromes)
0$              Push 0 and swap, keeping n on top and increasing the
                length of the stack by 1

><> is toroidal, so the above executes in a loop until the stack consists of n at the top with n-1 zeroes below, at which point it moves to the second line.
The first time the second line is executed, the n instruction is run, printing the n at the top of the stack. This leaves just the n-1 zeroes, and we do the following, also in a loop:
l?!;            If the stack is empty, terminate
" : "ooo        Print the reverse of " : " (but hey, palin...)
n               Print one of the 0s, decreasing the stack's length by 1
                This reuses the same n instruction from before

" ? "ooo       Print the reverse of " ? " (but hey, palindromes) is printing the reverse shorter than printing the actual string?

@Caridorc Yes, because ><> can only print char-by-char by popping off a stack :)

sp3000 nice to know.

Scala, 78 71 52 50 bytes
def f(n:Int)=(1 to n).mkString(" ? ")+" : 0"*(n-1)

PowerShell Core, 52 38 bytes
param($a)(1..$a-join' ? ')+' : 0'*--$a

Try it online!
Save 14 bytes thanks to mazzy!

Try it online! ?

or Captain Hook! :)

it was a hard choice :) Thanks ! ⏰

Jelly, 12 bytes
Rj“:?0”s2ZFK

Try it online!
How it works
Rj“:?0”s2ZFK - Main link. Takes n on the left
R            - Yield the range [1, 2, ..., n]
 j“:?0”      - Join by “:?0”; [1, ":", "?", "0", 2, ..., ":", "?", "0", n]
       s2    - Split into pairs; [[1, ":"], ["?", "0"], ..., ["?", "0"], [n]]
         Z   - Transpose; [[1, "?", ..., "?", n], [":", "0", ..., ":", "0"]]
          F  - Flatten; [1, "?", 2, ..., "?", n, ":", "0", ..., ":", "0"]
           K - Join by spaces; "1 ? 2 ... ? n : 0 ... : 0"

Stax, 12 bytes
å■Åxb◄34Γφ¥r

Run and debug it

Zsh, 50 bytes
s=${(j: ? :)$(seq $1)}
repeat $1-1 s+=' : 0'
<<<$s

Try it online!


text:
Antiferromagnetic ordering

Antiferromagnetism is what IBM researchers used to jump from a 1 terabyte disk to a 100 terabyte disk in the same amount of atoms.
In materials that exhibit antiferromagnetism, the magnetic moments of atoms or molecules, usually related to the spins of electrons, align in a regular pattern with neighboring spins (on different sublattices) pointing in opposite directions.
Your job is to write a program that draws the ordering of antiferromagnetic atoms like the picture shown above. You must be able to have at least four sets of pairs, though you may have more.
Each pair must be shown as follows, though they must be actual arrows:

 up  down
down  up
 up  down

Your output can be in ascii art or graphical output.
You can make only a function or a whole program, but it must take an input and draw that many pairs. Examples with only words:
Input: 1

 up  down
down  up
 up  down

Input: 2

 up  down  up  down
down  up  down  up
 up  down  up  down

Acceptable arrows:

↑ and ↓
⇅ and ⇵
/|\ and \|/

Please put your answers in Language, X bytes format, as it's easy to read. The least amount of bytes wins!

You may want to give more constraints on the output, since most answers would then be low quality for the sake of golfing. Maybe take input of how many pairs to output and give example output that must be adhered to.

@Maltysen Any arrows are ok, but I'd like to see graphical ones. It also depends on what type of ascii-esc arrow it is, such as /|\\ or a unicode one.

The output is always three rows right?

@rink.attendant.6 Correct

"Any arrows" sounds pretty ambiguous to me - what about ^v?

@Sp3000 No, cause they don't have the little tails.

Are these arrows allowed: ⇅ and ⇵? (unicode code points U+21C5 and U+21F5)

@DigitalTrauma They are perfect!

@Phase I rolled back your edit.  Changing the scoring from bytes to chars will significantly change scores for a lot of these answers.  Changing the rules after getting 15 answers is generally frowned upon.

would you accept /\ and / as arrows?

@BetaDecay As I said about ^v, they've got to have tails.

@Phase Damn, that's a shame

APL, 18 12 bytes
⍉(2×⎕)3⍴'↑↓'

This constructs a 2n x 3 matrix, where n is the input (⎕), filled with the characters ↑ and ↓. The transpose (⍉) of this matrix is then printed.
You can try it online.

Nice abuse of the APL character set. I guess other answers can also use this character set, though.

@jimmy23013: The APL code page is EBCDIC-based. Not sure how many languages can handle that.

@Dennis Can't the program itself be in ASCII (or some gibberish in EBCDIC) while it prints EBCDIC strings? The shortcut for newlines would be gone, though. Alternatively, the Windows console seemed to print \x18\x19 as ↑↓.

Or these codepages.

@jimmy23013: Yes, I just talked about old consoles in chat. The gibberish might work, but it's probably worth a meta discussion.

Pyth, 15 bytes (11 chars)
V3.>*Q"↑↓"N

Try it online: Demonstration
Explanation:
              implicit: Q = input number
V3            for N in [0, 1, 2]:
      "↑↓"       string "↑↓"
    *Q           repeat Q times
  .>      N      rotate the string by N

Java, 313 296 bytes
Here's an example that displays arrows graphically:
import java.awt.*;void f(int n){new Frame(){public void paint(Graphics g){for(int k=0,l,m,o;k<n*6;o=k%6,l=o/2*10+32,m=k/6*20+(k++%2==0?19:29),g.fillPolygon(new int[]{m+4,m,m+4,m+4,m+6,m+6,m+10},o==1|o==2|o==5?new int[]{l+9,l+5,l+5,l,l,l+5,l+5}:new int[]{l,l+5,l+5,l+9,l+9,l+5,l+5},7));}}.show();}

In a more readable format:
import java.awt.*;
void f(int n) {
    new Frame() {
        public void paint(Graphics g) {
            for (int k = 0, l, m, o; k < n*6;){
                o = k % 6;
                l = o / 2 * 10 + 32;
                m = k / 6 * 20 + (k++ % 2 == 0 ? 19 : 29);
                g.fillPolygon(new int[] {m+4,m,m+4,m+4,m+6,m+6,m+10},
                              o == 1 || o == 2 || o == 5 ?
                                  new int[] {l+9,l+5,l+5,l,l,l+5,l+5} :
                                  new int[] {l,l+5,l+5,l+9,l+9,l+5,l+5},
                              7);
            }
        }
    }.show();
}

The display for 5 as input:

You'll have to resize the window that appears to see the arrows. I tried to make it so that none of them would appear "chopped off" by the window's inside border, but it may appear that way on certain platforms.

CJam, 18 bytes (14 chars)
ri3*"↑↓"*3/zN*

Generate the columns (which form a repeating pattern) then transpose.
Try it online.

Alternative 18 bytes:
3,ri"↑↓"*fm>N*

Rotate the string "↑↓"*n by 0, 1 or 2 times.

CJam (15 chars, 19 bytes)
ri"↑↓"*_(+1$]N*

Online demo

Win condition is bytes, not chars.

@PeterTaylor: The challenge specified Language, X bytes format. You have it in char format, but unicode characters are worth 2 bytes so your actual score is 17 bytes

@Levi According to this they're 3 bytes each.

@isaacg ah my bad

Befunge, 71 bytes
My first answer, so please be gentle with me :o)
Annoying alignment issues resulted in a few wasted bytes, if you have any improvements for me I'd love to hear them!
&::3>:2% #v_0#v" \|/ "<
  >\^,*52<> 0#v" /|\ "<
:#^_$1-:#^_@  >:#,_$\1-

Input: 4
 /|\  \|/  /|\  \|/  /|\  \|/  /|\  \|/
 \|/  /|\  \|/  /|\  \|/  /|\  \|/  /|\
 /|\  \|/  /|\  \|/  /|\  \|/  /|\  \|/

CJam, 14 bytes
0000000: 332c 7269 2218 1922 2a66 6d3e 4e2a       3,ri".."*fm>N*

This requires a supporting terminal that renders code page 850 like this:

The non-pointy part of the code turned out to be identical to @Sp3000's alternative version.

CJam, 17 bytes
ri"⇅⇵⇅"f*N*

Cheaty double arrow version, with credits to @DigitalTrauma.
Try it online.

Pyth, 16 bytes (12 chars)
J"↑↓"V3*~_JQ

Example:
Input: 4
Output:
↑↓↑↓↑↓↑↓
↓↑↓↑↓↑↓↑
↑↓↑↓↑↓↑↓

Python 2, 131 122 bytes
from turtle import*
for k in range(input()*6):z=k/3+k%3&1;pu();goto(k/3*32,z*32^k%3*64);pd();seth(z*180+90);fd(32);stamp()

Well... I beat C Java I guess?

I've chosen height 32 for the arrows, which is pretty large, so after a while the turtle starts drawing offscreen. If you want everything to fit for large inputs, you can either make the arrows smaller by replacing the 32s, or use screensize() (I'm not sure if there's a meta post on offscreen output...)

So... when are going to add turtle graphics to Pyth?

Surely for golfing purposes you should choose a single digit number for the sizing...

@BetaDecay For single digit sizing the tail is barely visible, since it's obscured by the turtle

GNU sed, 25 bytes
I found the ⇅ and ⇵ unicode arrow symbols, which allow more shortening and they have been allowed by this comment:
h
s/1/⇅/g
H
G
s/1/⇵/g

Input is in unary, so e.g. 4 is 1111:
$ echo 1 | sed -f antiferro.sed
⇅
⇵
⇅
$ echo 1111 | sed -f antiferro.sed
⇅⇅⇅⇅
⇵⇵⇵⇵
⇅⇅⇅⇅
$

Previous answer in case ⇅ and ⇵ are disallowed:
GNU sed, 39 bytes
s/1/↑↓/g
s/.*/&a&↑\n&/
s/a↑/\n/

Whenever I see "GNU sed" at the top of a post, I don't even need to scroll down to know who posted it.

@AlexA. This guy? ;-)

Input is in unary?! Is that a general for the language or something you programmed in?

What a nefarious answer :-)

@BetaDecay Re unary input - please check out the linked meta-question. Let me know if it doesn't make sense.

@xebtl Thats a lot of the fun of it for me :) - trying to find answers that push the limits of the rules, but are still (hopefully) valid

@DigitalTrauma Yeah I think it makes sense... So you're treating the unary number as string and finding its length?

@BetaDecay thats the unique property of unary strings - their numeric value is equal to their length.  The meta question/answer allows for this strictly for languages that don't have native arithmetic (e.g. sed).  This is particularly handy for this question, because the output of the required length can easily be generated from the unary input. Cheaty? perhaps - but the meta answer consensus seems to be OK with it.

Ruby 39 (or 44) characters, 43 (or 48) bytes
According to https://mothereff.in/byte-counter the arrow characters are 3 bytes each!
->(n){a=['↑↓'*n]*3;a[1]=a[1].reverse;a}

An anonymous function which returns an array. If the function has to print the array, it should end with puts a for 5 more bytes.
Example use
f=->(n){a=['↑↓'*n]*3;a[1]=a[1].reverse;a}

puts f.call(6)

Gives
↑↓↑↓↑↓↑↓
↓↑↓↑↓↑↓↑
↑↓↑↓↑↓↑↓

J, 41 35 32 bytes (28 characters)
3$(,:|.)(2*".1!:1[1)$ucp'↑↓'

I have never programmed anything in J so this took me a while, and it's most definitely not the best way to do it.
This waits for you to input a number when run before outputing the arrows.

What do you mean you haven't programmed anything in J? I seem to recall a certain J answer which got you over 1k rep. ;)

@AlexA. Doing simple arithmetics is not really what I would call programming. When I posted that answer I really didn't know anything about J besides the right to left priority

Swift 2, 66 bytes
let f={n in(0..<n*3).map{print("↑↓",appendNewline:$0%n==n-1)}}

If Swift would be just a liiiitle bit less verbose, it wouldn't even be that bad for golfing (I'm looking at you, named parameter appendNewline)

J, 30 bytes
|:((2*".1!:1<1),3)$ucp'↑↓'

Octave, 37 bytes
EDIT: corrected from the earlier stripe-antiferromagnetic version.  Thanks @beta-decay for catching my mistake.
f=@(n)repmat(["⇅";"⇵";"⇅"],1,n)

Defines a function f(n).  Sample output:
octave:4> f(1)
ans =

⇅
⇵
⇅

octave:5> f(5)
ans =

⇅⇅⇅⇅⇅
⇵⇵⇵⇵⇵
⇅⇅⇅⇅⇅

C, 169 170 162 125 123 105 119 107 bytes
So, I though I might as well give this a go, even though this is obviously not the winner :)
Golfed:
n,i,j;main(){n=getchar();n=atoi(&n);for(;j++<3;){for(i=0;i++<n;)printf("%.3s ","⇅⇵"+(j%2)*3);puts("");}}

Ungolfed:
#include <stdio.h>
#include <stdlib.h>

/* n -> Number of columns, i & j -> Loop counters */
n,i,j;

main()
{
    /* Get the number of iterations from stdin */
    n = getchar();
    n = atoi(&n); /* Thanks @AndreaBiondo */

    for (; j++ < 3;)
    {
        /* Print rows of arrows */
        for (i = 0; i++ < n;)
            printf("%.3s ","⇅⇵" + (j % 2) * 3);

        /* Print a newline */
        puts("");
    }
}

Example:
Input: 4
⇵ ⇵ ⇵ ⇵
⇅ ⇅ ⇅ ⇅
⇵ ⇵ ⇵ ⇵

Update:
See it run here

You can do for(j=0;j++<3;) and the same with i

@ThomasKwa aha... well spotted. thanks

i and j are globals, so they're initialized to zero. You can drop i=0 and j=0.

Also, you can exploit little-endianess and zero initialization to use n as a buffer: n=getchar();n=atoi(&n);

@AndreaBiondo when i remove i=0 and j=0, all the output is on one line. can you reproduce this? i'm using gcc 4.9.2

I just noticed, this does not provide the correct output. Apart from the uneven spacing (which is easy to fix), the second row is not in the opposite direction - is it just me?

oops... both of those are errors in my code... will fix

Sorry, i=0 in the inner loop must stay there :) My bad. j=0 can be dropped.

Javascript (ES6), 66 63 53 47 bytes (62 55 49 41 characters)
f=n=>`⇅
⇵
⇅`.replace(/./g,'$&'.repeat(n))

Props to Digital Trauma for finding the ⇅ and ⇵ characters and allowing me to shave off more bytes.

05AB1E, 17 11 bytes
ƵηSnŽXæ+ç×»

Bug-fixed and -6 bytes thanks to @ovs.
Uses ⇅ and ⇵.
Try it online or verify some more test cases.
Slightly larger simplified approach - 15 bytes in UTF-8 (8 characters):
"⇅⇵"ĆS×»

Try it online or verify some more test cases.
Explanation:
Unfortunately the 05AB1E codepage doesn't contain the arrow characters, so we have to create them ourselves or use UTF-8 encoding for the entire program.
Ƶη           # Push compressed integer 171
  S          # Convert it to a list of digits: [1,7,1]
   n         # Square each: [1,49,1]
    ŽXæ+     # Add compressed integer 8644 to each: [8645,8693,8645]
        ç    # Convert them to characters with these codepoints: ["⇅","⇵","⇅"]
         ×   # Repeat each character the (implicit) input amount of times as strings
          »  # And join this list of strings by newlines
             # (after which it is output implicitly as result)

"⇅⇵"        # Push string "⇅⇵"
     Ć       # Enclose, appending it's own head: "⇅⇵⇅"
      S      # Convert it to a list of characters: ["⇅","⇵","⇅"]
       ×»    # Same as above

See this 05AB1E tip of mine (section How to compress large integers?) to understand why Ƶη is 171 and ŽXæ is 8644.

I think ⇅ is meant as two arrows, one up and one down. This allows for a shorter solution: https://tio.run/##AR0A4v9vc2FiaWX//8a1zrdTbsW9WMOmK8Onw5fCu///Mw

@ovs Oops.. I read it correctly, but implement it incorrectly. Not sure how I didn't notice that.. And thanks. I especially like that ƵηSn.

BBC BASIC, 70 bytes
INPUTx:n$=STRING$(x,"/|\\|/"):PRINTn$:PRINTSTRING$(x,"\|//|\"):PRINTn$

This can probably be golfed more

C, 97 bytes
Takes the input from the first command-line parameter, e.g. main 4. Supports up to 357913940 pairs. In C you can't use multibyte characters as chars but they work fine as strings.
i,n;main(c,v)char**v;{n=atoi(v[1]);for(i=6*n+3;i--;)printf("%s",i%(2*n+1)?i%2?"↓":"↑":"\n");}

It is smaller as a function, but the other C answers were complete programs so I did that too. It would be 69 bytes:
i;f(n){for(i=6*n+3;i--;)printf("%s",i%(2*n+1)?i%2?"↓":"↑":"\n");}

Python 2, 47 bytes
Port of my BBC BASIC answer, taking advantage of how Python can easily reverse strings.
n=r"/|\\|/"*input();print n+"\n"+n[::-1]+"\n"+n

JavaScript (ES6), 66 bytes (62 chars)
That includes the Unicode character counted as three bytes each as well as the mandatory newline counted as one byte.
Uses recursion as inspired by this answer. I tried it non-recursively but generating a defined array took too many characters, although someone else might know how to do it better than me.
f=n=>(g=(a,i)=>i?g(`
↓↑`[i%(n*2+1)&&1+i%2]+a,i-1):a)('',n*6+2)

Demo
As with all ES6 answers, they are demonstrable in Firefox, Edge, and Safari 9 only at time of writing:

f = n => (g = (a, i) => i ? g(`
↓↑` [i % (n * 2 + 1) && 1 + i % 2] + a, i - 1) : a)('', n * 6 + 2)

console.log = x => document.getElementById('O').innerHTML += x + '\n';

console.log(f(1));
console.log(f(2));
console.log(f(4));
console.log(f(32));

<output id=O></output>

CoffeeScript, 60 bytes (58 chars)
Comprehensions make it easy without recursion:
f=(n,x='')->x+='\n⇵⇅'[i%(n+1)&&1+i%2]for i in[1..n*3+2];x

Ruby, 33 bytes
As a function:
f=->n{[s="↑↓"*n,s.reverse,s]}

Example:
> puts f[3]
↑↓↑↓↑↓
↓↑↓↑↓↑
↑↓↑↓↑↓

Ruby, 37 bytes
Full program which takes input from stdin:
puts s="↑↓"*gets.to_i,s.reverse,s

You can make only a function or a whole program, but it must take an input and draw that many pairs.

@Dennis ok, I'm on it

We seem to have a misunderstanding. I posted the quote to show that a function is in fact valid, since you implied in your original revision that a full program was required by the question.

@Dennis No problem. I was just thinking that returning 3 strings wasn't really "drawing", but I guess it doesn't matter. Anyways, got both versions golfed down a bit :)

><>, 55 Bytes
"⇅⇵⇅"{:&3*1-:0(?;\
|.!09v!?%&:&:{o:}/
oa{~}/|.!09

Try it online here, inputting the desired length as initial stack value.
Non ⇅⇵ solution, 59 Bytes:
"↓↑"{:&3*>1-:0(?;{:{\
 |.!09v!?%&:&:oo}}@:/
9oa{$}/|.!0

C, 117 89 85 bytes
i;main(j,v)char**v;{j=2*atol(v[1])+1;for(;i++<3*j;)printf(i%j?i%2?"↑":"↓":"\n");}

Ungolfed:
i;
main(j,v)
char**v; // Credit to @AndreaBiondo for brilliant idea that I will use a lot in future golfed programs :)
{
    j = 2*atol(v[1])+1;
    for(;i++<3*j;)
        printf(i%j?i%2?"↑":"↓":"\n");
}

Java, 150 bytes
static void g(int n){n*=2;f(n,0);f(n,1);f(n,0);}static void f(int n,int d){String l="";for(n+=d;n-->d;)l+=(n%2==0)?"↓":"↑";System.out.println(l);}

Output of g(2):
↑↓↑↓
↓↑↓↑
↑↓↑↓

I think that you're required to output arrows, so I'd suggest that you change your example output and code to make it absolutely clear that you aren't breaking the rules :)

@BetaDecay I see some approved arrows have been listed and I haven't made the cut! So following your advice I've changed it

Japt -R, 13 bytes
Went through a good few different methods but couldn't do better than 16 then I realised a port of Kevin's solution would come in a bit shorter.
#«ì £çX²d8644

Try it

Vyxal Dj, 11 bytes
‛↑↓3*½ÞTvṅ*

Try it Online!
-1 thanks to Aaron Miller

11 bytes

R, 60 62 bytes
Takes input from STDIN and outputs to STDOUT.  Creates a 3 x (2 * input) array, adds a column of carriage returns and then outputs the transposed array.
cat(t(cbind(array(c('↑','↓'),c(3,2*scan())),'\n')),sep='')

Test run
cat(t(cbind(array(c('↑','↓'),c(3,2*scan())),'\n')),sep='')
1: 25
2:
Read 1 item
↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓
↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑
↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓

Tcl 49 bytes
No winner but at least it's competitive:
foreach x {⇅ ⇵ ⇅} {puts [string repeat $x $argv]}

You can save bytes using lmap instead of foreach

And string repeatcan be abbreviated to string re

And I am not sure, but implementing it as a proc retrieving a side effect of lmap returning values and replacing $argv by someone one-letter variable may save bytes.

Python 2, 45 55 bytes
edit: modified arrows
Pretty straightforward approach. Doesn't work with unicode arrows, though.
def f(n):x=" /|\\ \\|/"*n;print x+"\n "+x[::-1]+"\n"+x

if you look at the comments in the original post, you will see that you are specifically not allowed to use ^v arrows as they do not have a tail

Thanks, I haven't noticed that. Changed it into "/|", hope it's ok now.

Swift 2.0, 79 bytes
Nothing clever...
let p=3;for x in 0...2{print((0..<p*2).reduce(""){$0+["↑","↓"][($1+x)%2]})}

This would need to be put in a function, having to change the code for input isn't allowed

source: Stack Exchange

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

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

sort: votes


text:
Roll my D&D character's ability scores
In Dungeons and Dragons, some of the most important atributes of a character are the ability scores. There are 6 ability scores, for the six abilities. The abilities are Strength, Dexterity, Constitution, Intelligence, Wisdom and Charisma.
When determining the scores for a character, I use the following procedure: Roll 4d6, drop the lowest, in any order. What this means is that I roll 4 six sided dice, ignore the lowest result, and sum the other 3. This is done 6 times. The resulting numbers are assigned to the abilities in any way I please.
The system I use for assigning scores to abilities is to assign the highest score to my character's most important skill, which depends on my character's class, assign the second highest score to Constitution, since everyone needs Constitution, and assign the other four scores arbitrarily.
Here's a table of the most important skills for various classes:
Bard - Charisma
Cleric - Wisdom
Druid - Wisdom
Fighter - Stregth
Monk - Wisdom
Paladin - Charisma
Rogue - Dexterity
Sorcerer - Charisma
Wizard - Intelligence

Challenge: I'll give you (as input) the first letter of my character's class (In uppercase). I'd like you to roll the abilities scores and assign them to the abilities as described above, and then output them in the order Strength, Dexterity, Constitution, Intelligence, Wisdom, Charisma.
Example:
Input: R
Rolls: 4316 3455 3633 5443 2341 6122
Scores: 13 14 12 13 9 10
Ordering: Highest goes to dexterity. Second goes to Constitution.
Output: 13 14 13 12 9 10
or
Output: 9 14 13 10 12 13
or etc.

Output may be given in any format where the numbers are clearly separated and in the proper order.
Shortest code in bytes wins. Standard loopholes banned.

CJam, 43 41 40 bytes
{6a4*:mr$0Zt:+}6*]$2m<"FRXWCDM"r#4e<3e\p

Thanks to @Sp3000 for golfing off 1 byte.
Try it online in the CJam interpreter.
How it works
{             }6*                       e# Repeat 6 times:
 6a4*                                   e#   Push [6 6 6 6].
     :mr                                e#   Replace each six with a pseudo-randomly
                                        e#   generated integer in [0 ... 5].
        $                               e#   Sort the results.
         0Zt                            e#   Replace the lowest result by 3.
            :+                          e#   Add all four integers
                ]                       e# Wrap the 6 generated integers in an array.
                 $                      e# Sort.
                  2m<                   e# Rotate 2 units to the left to assign the
                                        e# second highest result to Constitution.
                     "FRXWCDM"          e# Push that string.
                              r#        e# Find the index of the input.
                                        e# The string doesn't contain B, P or S, so
                                        e# those push -1.
                                4e<     e# Truncate the index at 4. This way, C, D
                                        e# M all push 4.
                                   3e\  e# Swap the integer at that index with the
                                        e# one at index 3, i.e., the highest one.
                                      p e# Print.

Python 3, 137 bytes
from random import*
S=sorted
*L,c,h=S(3+sum(S(map(randrange,[6]*4))[1:])for _ in[0]*6)
L[:"FRW BPS".find(input())]+=h,
L[:2]+=c,
print(L)

Outputs a list of integers, e.g. [14, 9, 13, 12, 12, 13] for F.
The mapping from the input char to assignments turned out to be surprisingly nice. First we start by having L contain the lowest 4 rolls, after which we want to insert

The highest roll into the correct position based on the input, then
The second-highest roll into index 2, for Constitution.

For each input, the indices we want for the highest rolls are:
Index    Ability          Input(s)
----------------------------------
0        Strength         F
1        Dexterity        R
2        Intelligence     W
3        Wisdom           CDM
4        Charisma         BPS

Amazingly, we only need "FRW BPS".find(input()) for this, because:

FRW work as expected, giving their respective indices,
CDM are not present so find gives -1, which for a 4-element list is index 3, and
BPS give 4, 5, 6 respectively, but it doesn't matter if we overshoot because we can only append an element at the end.

J, 100 97 bytes
(0;0,b)C.^:(b>0)(0;1 2)C.\:~+/"1]1}."1/:~"1]1+?6 4$4$6[b=.('BCDFMPRSW'i.1!:1[1){5 4 4 0 4 5 1 5 3

Takes input in STDIN

I hear Prolog is getting jealous...

@AlexA. We're just taking a break, I can try something else in the meanwhile...

C++ - 387 bytes
First attempt here, more golfing required, particularly in determining what class is being used.
Golfed:
#include<cstdlib>
#include<cstdio>
#include<time.h>
int main(int c,char**v){char*o=*v,l=*v[1];int b=-1,s=-1,i=6,x=0,q=l>=67&&l<=68||l==77?4:l==70?0:l==87?3:l==82?1:5;srand(time(0));for(;i-->0;){int w=9,d=4,u=3,t;for(;d-->0;){t=rand()%6;if(t<w){u+=w<9?w:0;w=t;}else u+=t;}if(u>s){c=s;s=u;u=c;}if(s>b){c=s;s=b;b=c;}if(u>=0)o[x++]=u;}for(i=0;i<6;i++)printf("%d ",i==2?s:(i==q?b:o[--x]));}

Rather ungolfed:
#include<cstdlib>
#include<cstdio>
#include<time.h>
int main(int c,char**v)
{
    //name of program must be at least 4 chars
    char*others=*v,clas=*v[1];
    int desired = clas>=67&&clas<=68||clas==77?4:clas==70?0:clas==87?3:clas==82?1:5; //TODO:

    srand(time(0));
    int best=-1,second=-1,i=6,otherIndex=0;
    for(;i-->0;)
    {
        int lowest=9,diecount=4,sum=3;
        for(;diecount-->0;)
        {
            int loc=rand()%6;
            if (loc<lowest)
            {
                sum+=lowest<9?lowest:0;
                lowest=loc;
            }
            else
            {
                sum+=loc;
            }
        }
        if(sum>second)
        {
            c=second;second=sum;sum=c;
        }
        if(second>best)
        {
            c=second;second=best;best=c;
        }
        if(sum>=0)
        {
            others[otherIndex++]=sum;
        }
    }

    for(i=0;i<6;i++)
    {
        printf("%d ",i==2?second:(i==desired?best:others[--otherIndex]));
    }

    getchar();
}

312 bytes

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


text:
Backhanded^H^H^H^H^H^Hspaces
On some terminals, pressing backspace generates the control code ^H to delete the previous character. This gave rise to a snarky idiom where edits are feigned for comedic effect:

Be nice to this fool^H^H^H^Hgentleman, he's visiting from corporate
  HQ.

Given a string with one or more ^H's, output the result of backspacing on each ^H. The input will use only printable characters (ASCII 32-126), and ^ will only appear as ^H. Backspaces will never happen on empty text.
You may not assume that the output environment supports control codes, in particular the backspace code \x08.
>> Horse^H^H^H^H^HCow
Cow

>> Be nice to this fool^H^H^H^Hgentleman, he's visiting from corporate HQ.
Be nice to this gentleman, he's visiting from corporate HQ.

>> 123^H45^H^H^H78^H
17

>> Digital Trauma^H^H^H^H^H^H^H^H^H^H^H^H^H^HMaria Tidal Tug^H^H^H^H^H^H^H^H^H^H^H^H^H^H^HDigital Trauma
Digital Trauma

Leaderboard
Here's a by-language leaderboard, courtesy of Martin Büttner.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
# Ruby, <s>104</s> <s>101</s> 96 bytes

function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/52946/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function getAnswers(){$.ajax({url:answersUrl(page++),method:"get",dataType:"jsonp",crossDomain:true,success:function(e){answers.push.apply(answers,e.items);if(e.has_more)getAnswers();else process()}})}function shouldHaveHeading(e){var t=false;var n=e.body_markdown.split("\n");try{t|=/^#/.test(e.body_markdown);t|=["-","="].indexOf(n[1][0])>-1;t&=LANGUAGE_REG.test(e.body_markdown)}catch(r){}return t}function shouldHaveScore(e){var t=false;try{t|=SIZE_REG.test(e.body_markdown.split("\n")[0])}catch(n){}return t}function getAuthorName(e){return e.owner.display_name}function process(){answers=answers.filter(shouldHaveScore).filter(shouldHaveHeading);answers.sort(function(e,t){var n=+(e.body_markdown.split("\n")[0].match(SIZE_REG)||[Infinity])[0],r=+(t.body_markdown.split("\n")[0].match(SIZE_REG)||[Infinity])[0];return n-r});var e={};var t=1;answers.forEach(function(n){var r=n.body_markdown.split("\n")[0];var i=$("#answer-template").html();var s=r.match(NUMBER_REG)[0];var o=(r.match(SIZE_REG)||[0])[0];var u=r.match(LANGUAGE_REG)[1];var a=getAuthorName(n);i=i.replace("{{PLACE}}",t++ +".").replace("{{NAME}}",a).replace("{{LANGUAGE}}",u).replace("{{SIZE}}",o).replace("{{LINK}}",n.share_link);i=$(i);$("#answers").append(i);e[u]=e[u]||{lang:u,user:a,size:o,link:n.share_link}});var n=[];for(var r in e)if(e.hasOwnProperty(r))n.push(e[r]);n.sort(function(e,t){if(e.lang>t.lang)return 1;if(e.lang<t.lang)return-1;return 0});for(var i=0;i<n.length;++i){var s=$("#language-template").html();var r=n[i];s=s.replace("{{LANGUAGE}}",r.lang).replace("{{NAME}}",r.user).replace("{{SIZE}}",r.size).replace("{{LINK}}",r.link);s=$(s);$("#languages").append(s)}}var QUESTION_ID=45497;var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";var answers=[],page=1;getAnswers();var SIZE_REG=/\d+(?=[^\d&]*(?:<(?:s>[^&]*<\/s>|[^&]+>)[^\d&]*)*$)/;var NUMBER_REG=/\d+/;var LANGUAGE_REG=/^#*\s*((?:[^,\s]|\s+[^-,\s])*)/
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
<link rel=stylesheet type=text/css href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	AuthorLanguageSize

Winners by Language

LanguageUserScore

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

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

Is AAA^HB^H^H valid?

@NathanMerrill Yes, and it results in A.

I suspect retina would do well here.

is ^HAvalid? More generally, can strings start with a useless backspace?

@Fatalize: "Backspaces will never happen on empty text."

@Maria Tidal Tug comes back to haunt me

The URL in the leaderboard snippet should be https://, since the snippet doesn't work in newer versions of Chrome that don't load insecure resources on pages loaded over HTTPS.

@Frxstrem Changed it to https.

I tried to implement this in the correct language for such a problem, chicken, but I'm new to chicken and gave up eventually...  I'd love to see if any senior chicken developers could post a solution.

@Frxstrem Or //

May we take input with actual backspaces?

@Adám No, use ^H's.

Suggested test case from ~3 years into the future: H^Hello H^HLarry!

GNU sed, 11 bytes
:;s/.^H//;t

Test output:
$ echo "Horse^H^H^H^H^HCow
Be nice to this fool^H^H^H^Hgentleman, he's visiting from corporate HQ.
123^H45^H^H^H78^H
Digital Trauma^H^H^H^H^H^H^H^H^H^H^H^H^H^HMaria Tidal Tug^H^H^H^H^H^H^H^H^H^H^H^H^H^H^HDigital Trauma" | sed ':;s/.^H//;t'
Cow
Be nice to this gentleman, he's visiting from corporate HQ.
17
Digital Trauma
$

Look who showed up! It's Maria Tidal Tug^H^H^H^H^H^H^H^H^H^H^H^H^H^H^HDigital Trauma!

@AlexA. Am I missing an in-joke?

@immibis: See Digital Trauma's comment on the question.

sed -r ':;s/(^|.)\^H//;t' - this works at expense of extra 6 bytes

@aragaer Why is that necessary? The OP says "Backspaces will never happen on empty text".  I think a ^H the beginning of the string is a backspace on empty text.

I thought it was valid to press backspace more times than there are characters in front of it.... I do it all the time myself!

Pyth, 11 bytes
.U+PbZcz"^H

Demonstration.
.U+PbZcz"^H
               Implicit: z = input()
      cz"^H    z.split("^H")
.U             reduce, with the first element of the list as the initial value.
   Pb          Remove the last character of what we have so far.
  +  Z         And add on the next segment.
               Print implicitly.

Gema, 6 bytes
?#\^H=

Sample run:
bash-4.3$ gema -p '?#\^H=' <<< 'pizza is alright^H^H^H^H^H^Hwesome'
pizza is awesome

CW, because the fool vs. gentleman example takes far too long. (Killed after a day. Maybe a glitch in the interpreter? All other examples here are processed in fractions of seconds.) Gema's recursive pattern not seems to be affected by the recursion level, but the amount of non-matching text increases processing time exponentially.

Is there a link to the language? A quick search on Github turned up quite a few

Sure. http://gema.sourceforge.net/ (BTW, the Gema project was registered 2003-10-27, while GitHub was launched 2008-04-10. That may be a reason to not find it there.)

I believe the recursion depth is equally to the length of the non-matching string, because it will recurse again and again until the \^H maches, matching one character at a time to the ?.

C, 52 bytes
j;f(char*s){for(j=0;*s=s[j];s[j]==94?s--,j+=3:s++);}

We define a function f that takes a pointer to the string as input. After the function call, that pointer will contain a modified string.
A simple test:
int main(int argc, char** argv) {
    char buf[300] = "Digital Trauma^H^H^H^H^H^H^H^H^H^H^H^H^H^HMaria Tidal Tug^H^H^H^H^H^H^H^H^H^H^H^H^H^H^HDigital Trauma";
    f(buf);
    printf(buf);
    return 0;
}

The above prints:
Digital Trauma

This was really clever. A couple things I noticed: globals are already initialized to zero, so no need to init j in your for loop (of course then it's single use, but I don't see anything about that in the rules :) ). You can also combine the assignment with the decrement: j;f(char*s){for(;s[j]==94?*s--=s[j],j+=3:s++);} (47 bytes)

@ColeCameron you missed this

@undergroundmonorail dang, I was just double checking to see if I missed that. I'm still new to code golf but I'll remember that for the future :). Thanks for the info!

@ColeCameron No problem, it's easy to miss stuff (and it's good that you checked at all :P)

@ColeCameron That has an unsequenced modification and access (UB), and causes an immediate EXC_BAD_ACCESS on my compiler/machine, unfortunately.

You can replace == with ^ if you swap the last operands of ?: :)

@Quentin I tried that, but because of the comma in s--, j+=3 and operator precedence, it doesn't work right.

@BrainSteel oh, right.

Haskell, 47 bytes
h(a,_:_:b)=f$init a++b;h(x,_)=x
f=h.span(/='^')

Defines a function f :: String -> String. How it works:
    f "ab^Hc^Hd"
=== h ("ab", "^Hc^Hd")   (find ^H)
=== f ("a" ++ "c^Hd")    (backspace)
=== f "ac^Hd"            (join)
=== h ("ac", "^Hd")      (find ^H)
=== f ("a", "d")         (backspace)
=== f "ad"               (join)
=== h ("ad", "")         (find ^H)
=== "ad"                 (no ^H: base case)

I think you can save a byte by swapping the two cases of h and doing h(x,_)=x for the empty string case.

CJam, 14 13 bytes
q"^H"/{W\ts}*

How it works
q                   e# Read the entire input
 "^H"/              e# Split it on occurrences of string "^H"
      {    }*       e# Reduce on the split array
       W\t          e# This is the tricky part. We know that if there are two parts that we
                    e# are reducing on, they must be separated by "^H". Which in turn means
                    e# that from the first part, last characters needs to be deleted
                    e# So we simply put the second part in place of the last character of the
                    e# first part.
          s         e# Doing the above makes it a mixed array of character and string.
                    e# So we convert it to a single string, ready to be served as first part
                    e# in next reduce iteration

UPDATE: 1 byte saved thanks to jimmy23013
Try it online here

1 byte shorter: W\ts.

Retina, 13 bytes
Retina
+`.\^H(.*)
$1

The two lines should go to their own files but you can run the code as one file with the -s flag.
At each step we delete the first match for .\^H in the string. We repeat this (with the + modifier) until no deletion happens.

Just a curiosity: why the capturing of (.*), as it seems to be just put back unchanged?

@manatwork This way we only capture the first .\^H in one step. Otherwise abc^H^H^H would result in ab^ after the first step.

Apologies for not implementing a replacement limit yet (which would probably allow something like +1\.^H`). ;)

JavaScript (ES6), 39 bytes

f=s=>(t=s.replace(/.\^H/,''))!=s?f(t):t

// TEST

Out=x=>O.innerHTML+=x+'\n'

Test=_=>(Out(I.value + "\n-> " + f(I.value)),I.value='')

;["Horse^H^H^H^H^HCow"
,"Be nice to this fool^H^H^H^Hgentleman, he's visiting from corporate HQ."
,"123^H45^H^H^H78^H"
,"Digital Trauma^H^H^H^H^H^H^H^H^H^H^H^H^H^HMaria Tidal Tug^H^H^H^H^H^H^H^H^H^H^H^H^H^H^HDigital Trauma"]
.forEach(t => Out(t + "\n-> " + f(t)))
#I { width:400px }

<input id=I><button onclick='Test()'>-></button>

Perl, 20 16 15 bytes
(14 characters code + 1 character command line option.)
s/.\^H//&&redo

Sample run:
bash-4.3$ perl -pe 's/.\^H//&&redo' <<< "Be nice to this fool^H^H^H^Hgentleman, he's visiting from corporate HQ."
Be nice to this gentleman, he's visiting from corporate HQ.

Save 4 characters: 1while s/.\^H//

Wow! That's great @KevinReid. Thank you.

One more: s/.\^H//&&redo

Thank you, @Dennis. redo somehow not made its way into my skill set. Will have to change that.

Note that @Dennis's version will only work (as intended) if it's the only statement inside a loop or a { } block. (The reason why it works with perl -p is that the -p switch automatically wraps your code inside a while loop.) Kevin's version works in any setting.

Julia, 58 42 41 bytes
Saved 16 bytes thanks to manatwork and 1 thanks to Glen O!
f(s)='^'∈s?f(replace(s,r".\^H","",1)):s

This creates a recursive function that accepts a string and returns a string.
This replaces one occurrence of ^H at a time with an empty string while the input contains ^.
Examples:
julia> f("123^H45^H^H^H78^H")
"17"

julia> f("pizza is alright^H^H^H^H^H^Hwesome")
"pizza is awesome"

This is the first time I've seen Julia in the wild. Nice!

REGXY, 10 bytes
Uses REGXY, a regex substitution based language. Replaces any character followed by ^H with nothing. The second line then executes which is just a pointer to the previous line, repeating the substitution until it fails to match.
/.\^H//
//

This compiles and executes correctly with the sample interpreter in the link above, but the solution is perhaps a bit cheeky as it relies on an assumption in the vagueness of the language specification. The spec states that the first token on each line (before the /) acts as a label, but the assumption is that a null label-pointer will point back to the first command in the file with a null label (or in other words, that 'null' is a valid label). A less cheeky solution would be:
a/.\^H//
b//a

Which amounts to 13 bytes.

Python 3, 53 bytes
o=""
for x in input().split("^H"):o=o[:-1]+x
print(o)

But personally I like this wordier version better:
H=input().split("^H")
print(eval("("*~-len(H)+")[:-1]+".join(map(repr,H))))

The interesting thing is that
'B''a''c''k''h''a''n''d''e''d'[:-1][:-1][:-1][:-1][:-1][:-1]

actually works and gives 'Back', so I tried to map ^H  ->  [:-1] and any other char c  ->  'c' then eval, but unfortunately you can't have any strings afterwards without a +, so this fails:
'B''a''c''k''h''a''n''d''e''d'[:-1][:-1][:-1][:-1][:-1][:-1]'s''p''a''c''e''s'

Heyy... that's pretty neat.

+=works in the loop

@CatsAreFluffy It's o=o[:-1]+x, not o=o+x

Oops, missed that. Does something like o[:-2]=x work?

@CatsAreFluffy You can't assign to str

Haskell, 52 47 bytes
import Data.Lists
foldl1((++).init).splitOn"^H"

Usage example:
> map (foldl1((++).init).splitOn"^H") ["Horse^H^H^H^H^HCow", "123^H45^H^H^H78^H", "Digital Trauma^H^H^H^H^H^H^H^H^H^H^H^H^H^HMaria Tidal Tug^H^H^H^H^H^H^H^H^H^H^H^H^H^H^HDigital Trauma"]
["Cow","17","Digital Trauma"]

How it works:
                  splitOn"^H"     -- split on substring "^H", e.g "Horse^H^H^H^H^HCow" -> ["Horse","","","","","Cow"]
                 .                -- then
foldl1(         )                 -- fold from left by
            init                  --   first dropping the last char from the left argument
       (++).                      --   second concatenating left and right argument

Ruby, 27 24 20 bytes
(19 characters code + 1 character command line option.)
$_=$`+$'while/.\^H/

Thanks to:

Ventero for suggesting to use the global variables (-4 characters)

Sample run:
bash-4.3$ ruby -pe '$_=$`+$'"'"'while/.\^H/' <<< "Be nice to this fool^H^H^H^Hgentleman, he's visiting from corporate HQ."
Be nice to this gentleman, he's visiting from corporate HQ.

+1 I thought I'd do a Ruby answer until I saw this -- I'm pretty sure this is as small as it's gonna get. Great usage of []!

There was another version in the beginning: loop{$_[/.\^H/]=""}rescue"" This one is nicer as it demonstrates Ruby's exception handling coolness.

Haha, that's a great one :)

Better late than never: $_=$`+$'while~/.\^H/ for 20 (you can even drop the tilde if you don't care about the regexp literal in condition warning).

Thank you, @Ventero. The warning appears only in irb (at least in 2.1.5), so I don't care about it, as I run the code from command line. :)

@manatwork: Technically it appears in all ruby versions >= 1.9 (regex and string literals in conditions were deprecated after 1.8), I guess your ruby simply still defaults 1.8, whereas irb uses ruby 2.1.5.

Thank you for the information on the deprecation, @Ventero. Sorry, for the confusing wording, that version 2.1.5 actually applies to both ruby and irb: http://pastebin.com/eZaWtirp My first guess was different verbose mode, but both are on medium.

Vim, 12 bytes
qqt^3xh@qq@q

Try it online!
Makes use of the fact that "^ will only appear as ^H".
Explanation
qqt^3xh@qq@q
qq     @qq@q    Define an indefinitely looping recursive macro and immediately call it
  t^            Move to just before the next ^ character in the line
    3x          Delete 3 characters (the one to be deleted, ^, and H)
      h         Move left 1 step (to be in position for the next search)

V (vim), 16 14 bytes
qq:s/.^H
@qq@q

Try it online!
similar to sed, but uses Vim's recursion.

Nice! Looks like my regex would’ve been a lot simpler without the g flag

@OriginalOriginalOriginalVI replacing the first occurrence is simpler, but Leo's solution is just a ton smarter. I didn't notice that there were two other answers on this until I saw the thread :P

Pyth - 19 bytes
Reduce works really, really well with this but it only does one char at a time so I had to spend almost as many chars as the actual algo to do a replace ^H with linebreak. Looking for a better way to do that.
u?+GHnHbPGjbcz"^H"k

Try it online here.

Python 2, 50
It's a bit odd having a second lambda in there, but seems to be the best Python so far.
lambda s:reduce(lambda a,b:a[:-1]+b,s.split('^H'))

Julia, 41 39 bytes
s->foldl((t,v)->chop(t)v,split(s,"^H"))

What it's doing is using ^H as a delimiter, and then removing the last character on each string then concatenating the next string before removing the last character again. Unlike the other Julia answer, this is not a recursive function.
Note: I've removed the function name from the definition. Originally, it said f(s)= rather than s->, and you used it as f("AAA^HB^H^H")... but I'm saving two bytes by letting it be "anonymous", and use itself as its name. You use it like this:
(s->foldl((t,v)->chop(t)v,split(s,"^H")))("AAA^HB^H^H")

(you can also assign a variable to it as f=s->foldl((t,v)->chop(t)v,split(s,"^H")), then f("AAA^HB^H^H") will work)

TeaScript, 7 bytes [Not competing]
Not competing as TeaScript was made after this challenge was posted. This is here as reference.
xW/.\^H

This uses the new TeaScript 3, and recursive replaces to remove the characters

For some reason this counts as 8859 bytes on the leaderboard because of the ISO 8859 link...

regerence?  xD

Japt, 8 bytes
Ue/.\^H/

Try it online!
How it works
U        // Take the input,
e/.\^H/  // and recursively replace any char followed by "^H" with
         // (nothing, defaults to an empty string).
         // Implicit: output last expression

As a small update many years later, the working solution now seems to be e".\\^H. I couldn't get the regex version to work with the current interpreter.

brainfuck, 81 bytes
>,[[>+>+<<-]-[>-<---]>---------[>>+<<[-]]>>-[+<[-]<<<,[-]>>]<[<<+>>-]<,]<[<]>[.>]

Try it online!

ECMAScript 6, 57 bytes
s=>{while(~s.indexOf`^H`)s=s.replace(/.\^H/,'');return s}

This is probably golfable, just gotta think of a way probably not

How about s=>{while(s!=(s=s.replace(/.\^H/,""));return s}?

Or, if while and return are too long, it could be recursive: var f=s=>s==(s=s.replace(/.\^H/))?s:f(s)

@lm you should add the second parameter "" for replace. Then you have my answer :)

True. And the empty string argument needs to be there, I must have copied the wrong version :(

~s.indexOf\^H`can become/^H/.test(s)`

Generally for doesn't increase bytes overwhile

Try using eval: s=>eval("while(~s.indexOf`^H`)s=s.replace(/.^H/,'');s"). Untested, but it might work.

R, 54 52 bytes
f=function(s)ifelse(s==(r=sub(".\\^H","",s)),r,f(r))

Same basic idea as my Julia answer. This creates a recursive function that accepts a string and returns a string. If the input is equal to itself with a single occurrence of ^H removed, return it, otherwise call the function again.
You can try it online!

K5, 64 bytes
K isn't really designed for this kind of work...
{[s]$[2>#s;s;`=t:*&{"^H"~2#x_s}'1+!-2+#s;s;,/2#2!|(0,t,3+t)_s]}/

golflua, 36 bytes
\f(s)@o!=s o=s;s=s:g(".^H","",1)$~s$

Sample run:
Lua 5.2.2  Copyright (C) 1994-2013 Lua.org, PUC-Rio
> \f(s)@o!=s o=s;s=s:g(".^H","",1)$~s$
> w(f("Be nice to this fool^H^H^H^Hgentleman, he's visiting from corporate HQ."))
Be nice to this gentleman, he's visiting from corporate HQ.

Javascript, 62 bytes
Not the shortest one, but works fine.

t=prompt();while(t.match(R=/.\^H/))t=t.replace(R,'');alert(t);

This probably can be shortened a lot!

Not the shortest one and does not work eiither (try any of the test cases). The regexp should not be global (remove /g)

@edc65 Thanks for the tip. I tried some things and they worked. That's why I posted like that

Java, 78 77 bytes
String f(String a){while(!a.equals(a=a.replaceFirst(".\\^H","")));return a;}

You can remove the space after the comma to save one char.

(Visual)FoxPro any version 80 bytes
PARA t
DO WHILE AT('^H',t)>0
t = STRT(t,SUBS(t,AT('^H',t)-1,3))
ENDDO
RETU t

Repeating string translation to empty by finding ^H and backing up one character.

rs, 8 bytes
Technically, this doesn't count, as it depends on a feature I added after this question was posted. However, I think it's pretty neat.
+?1.\^H/

Live demo and test cases.

Is the new feature a limit replacement?

@xnor Yes: the ?1.

@Optimizer Why? You're losing to Gema anyway. :O

Yeah :( . Saw gema after posting comment

Jelly, 9 bytes
œṣ⁾^HṖ;¥/

Try it online!
Not a new approach, but the question was missing a Jelly answer
How it works
œṣ⁾^HṖ;¥/ - Main link. Takes a string S on the left
  ⁾^H     - Yield "^H"
œṣ        - Split on "^H"
       ¥/ - Reduce by the following:
     Ṗ    -   Remove the last character
      ;   -   And append the right argument

ping me in an hour :P

Vim, 38 35 bytes
Saved 3 bytes thanks to Leo!
qa:%s/\([^H]\|\^\@<!.\)\^H//g
@aq@a

Try it online!
See Razetime's answer for a shorter and smarter version of this.
qa:%s/\([^H]\|\^\@<!.\)\^H//g
@aq@a

qa                                     Start recording a macro a
  :%s/                                 Substitute in entire file
      \([^H]\|\^\@<!H\)                Regex for the character to be deleted
        [^H]                           A character that isn't H
            \|                         or
                    H                  an H
              \^\@<!                   that doesn't have a ^ before it
                       \^H             All of that followed by ^H
                          //           Replace with empty string
                            g          Global flag so it replaces multiple times
                                       Enter the command
@a                                     Recursively call macro a
  q                                    Stop recording
   @a                                  Run the macro
```

You need to pass V the -v flag in order to use verbose mode that turns  into a carriage return Try it online!
You could also directly insert a newline in the code instead Try it online!

Java - 123 bytes

I personally like the g---1 part the best.
String f(char[] a){String b="";for(int g=-1;++g<a.length;b=(a[g++]=='^'?b.substring(0,b.length()-1):b+a[g---1]));return b;}

expanded (slightly):
  String f(char[] a) {
      String b = "";
      for (int g = -1;
           ++g < a.length;
           b = (a[g++]=='^'
                ? b.substring(0, b.length() - 1)
                : b + a[g---1])
      );
      return b;
  }

Python 2, 74 + 2 = 76 Bytes
I've tried a few approaches so far, this is the best I've been able to come up with so far.
n=input();o='';c=0
for l in n:d=l=='^';o=[o+l*(1-c),o[:-1]][d];c=d
print o

Where are those 2 extra bytes coming from?

@xnor input has to be surrounded by quotes for this to work. I forgot to put that in the post.

I think the usual convention has been to allow string arguments to be taken in quotes for free, but I'm not totally sure.

Batch - 138 bytes
@!! 2>nul||cmd/q/v/c%0 %1&&exit/b
set s=%1&for /F %%a in ('"prompt $H&echo on&for %%b in (1)do rem"')do set D=%%a
echo %s:^H=!D! !D!%

The first line is a way of saving a few bytes over the lengthy @echo off&setLocal enableDelayedExpansion (which turns echo off and enables the delayed expansion of variables, in case you were wondering). I explained it in Tips for Golfing in Batch.
The second line is a neat little trick to save the a backspace control character into a variable. It's pretty hacky, and I can't pretend to take credit for it. It's sort of explained here. Basically uses the prompt command to generate a backspace character and captures it in a variable - in this case !D!.
The final line then performs the simple string manipulation of - replace ^H with !D!<SPACE>!D!.
C:\>bsp.bat "testing^H^H^H test"
"test test"

Unfortunately it breaks with cases like "AAA^HB^H^H" - where it should produce "A", it instead produces "A"B. Which is somewhat confusing. I'll have to look into how Batch string manipulation works in some more depth.
C:\>bsp.bat "AAA^HB^H^H"
"A"B

Thanks to to some helpful people over here - I now realize that I was only saving the backspace character (0x08), and so was only overwriting the characters. It now works with examples like the following:
C:\>bsp.bat "AAA^HB^H^H"
"A"

there's a shorter version: set s=%1&for /F %%a in ('prompt $H^&cmd /k^<nul')do set D=%%a

Mumps, 84 Bytes
R Z S T="",Y=$L(Z,"^H") F I=1:1:Y{S T=T_$P(Z,"^H",I) S:I<Y T=$E(T,1,$L(T)-1)} W !,T

This could probably be made shorter as a function (1 byte I was able to save in quick testing) but I kinda like the one-liner aspect... :-)
The braces come from the Intersystems Cache flavour of Mumps which is what I'm most versed in.

jq 1.5, 41 37 bytes
(34 characters code + 3 characters command line option.)
reduce(./"^H")[]as$t("";.[:-1]+$t)

Sample run:
bash-4.3$ bin/jq -R -r 'reduce(./"^H")[]as$t("";.[:-1]+$t)' <<< "Be nice to this fool^H^H^H^Hgentleman, he's visiting from corporate HQ."
Be nice to this gentleman, he's visiting from corporate HQ.

On-line test (Passing -R through URL is not supported – so input passed as JSON string literal. Passing -r through URL is not supported – check Raw Output yourself.)

><>, 39 38 36 bytes
There was no ><> answer so I thought I'd add one.
i:0(?v:'^'=?\
     ~   ~~i/
;!?lr<ro

JavaScript, 60 bytes
b=n=>(v=n.search('^H'))>0?b(n.replace(n.slice(v-1,v+2),'')):n

Not as good as edc65's answer, but I wanted to try something that didn't use Regex.

bash, 50 bytes
while [ "$a" != "${a/?^H/}" ];do a=${a/?^H/};done

Sample:
a=$'Horse^H^H^H^H^HCow'
while [ "$a" != "${a/?^H/}" ];do a=${a/?^H/};done
echo $a
Cow

a="Be nice to this fool^H^H^H^Hgentleman, he's visiting from corporate HQ."
while [ "$a" != "${a/?^H/}" ];do a=${a/?^H/};done
echo $a
Be nice to this gentleman, he's visiting from corporate HQ.

This could work with real (binaries) backspaces as well:
a=$'Be nice to this fool\b\b\b\bgentleman, he'\'$'s visiting from corporate HQ.'
echo $a.. but:
Be nice to this gentleman, he's visiting from corporate HQ... but:
printf %q\\n "$a"
$'Be nice to this fool\b\b\b\bgentleman, he\'s visiting from corporate HQ.'

while [ "$a" != "${a/?$'\b'/}" ];do a=${a/?$'\b'/};done
printf %q\\n "$a"
Be\ nice\ to\ this\ gentleman\,\ he\'s\ visiting\ from\ corporate\ HQ.

JavaScript, 60 Bytes
I know there is already a JS answer here, but wanted to do it without regexes, because regex is really almost a language by itself. I'm sorry if you feel I shouldn't post this, this is my first post.X is the string to be operated upon.
while((z=x.indexOf('^D'))>0){x=x.slice(0,z-1)+x.slice(z+2);}

Test
Put this into your browser's address bar.
javascript:x=prompt('Enter the sentence to be erased');while((z=x.indexOf('^D'))>0){x=x.slice(0,z-1)+x.slice(z+2);}alert(x);

I love JS because it will let you do things like saying (z=x.indexOf('^D))>0, and it will both assign z.indexOf('^D'); to x and evaluate z.indexOf('^D') in the condition, which saves me precious bytes in this problem. It's not very useful otherwise, but it's fun!

No problem posting another answer in a language that was already used. But please note that unless the task specifies otherwise, by default a program or a function is expected. Your is just a snippet. And please post your code in code block markup, so scripts like Code Golf UserScript Enhancement Pack can insert the code size beside the code.

Here is the relevant meta consensus regarding snippets as answers. Note that unnamed functions are fine.

Emacs Lisp, 45 73 bytes
(lambda(s)(while(string-match".^H"s)(set's(replace-match"" nil nil s)))s)

Searches for the first occurence of anything else and ^H as long as it exists and replaces it with an empty string.
Old, incorrect version
(lambda(s)(replace-regexp-in-string".^H"""s))

Sorry, but I'm afraid this is not enough – you have to do the replacing in multiple steps so “one^Hff^H^H^Huch” gets transformed into “ouch”.

Oracle SQL 11.2, 172 bytes
WITH v(s,i)AS(SELECT:1,INSTR(:1,'^')FROM DUAL UNION ALL SELECT LPAD(s,i-2)||SUBSTR(s,i+2),INSTR(s,'^',1,2)-3 FROM v WHERE i>0AND'^'<>s)SELECT s FROM v WHERE INSTR(s,'^')=0;

Un-golfed
WITH v(s,i) AS                        -- Recursive view, s-> string, i->pos of first ^
(
  SELECT :1,INSTR(:1,'^')             -- Initialisation view
  FROM   DUAL
  UNION ALL
  SELECT LPAD(s,i-2)||SUBSTR(s,i+2),  -- Remove the ^ at pos i and the characters before and after
         INSTR(s,'^',1,2)-3           -- Compute the pos of the next ^ (the 2nd of s as before the remove just above)
  FROM   v
  WHERE  i>0                          -- Exit clause : no more ^
    AND  s<>'^'                       -- Needed to circumvent oracle's cycle detection, without it 123^H45^H^H^H78^H will fail
)
SELECT s FROM v WHERE INSTR(s,'^')=0; -- Keep only the row without any ^

K (ngn/k), 23 16 bytes
-7 bytes by rereading question (specifically, "^ will only appear as ^H")
{x_/3#-1+x?"^"}/

Try it online!
Removes one instance of ?^H on each invocation, and is run until convergence (i.e. no more ^'s are present).

{...}/ run function on (implicit) input until it converges
-1+x?"^" get the index of the character immediately prior to the first ^ in x
x_/3# drop the value occurring at that index three times

Vyxal, 9 bytes
‛^H/ƒλ$Ṫp

Try it Online! Port of caird coinheringaahing's Jelly answer.
   /      # Split on
‛^H       # "^H"
    ƒλ--- # Reduce by
        p # Prepend to the first item
      $Ṫ  # The second with its last item removed

Javascript ES6, 41 39 bytes
f=s=>s==(s=s.replace(/.\^H/,""))?s:f(s)

, 8 chars / 10 bytes (noncompetitive)
ïė/.\^H/

Try it here (Firefox only).
Works like all of the other JSGL's.

APL (Dyalog Unicode), 18 bytes
'.\^H'⎕R''⍠'ML'1⍣≡

Try it online!

Swift, 81 bytes
let f={(s:inout _)in while(s+"").contains("^"){s={s.replacing}()(#/.\^H/#,"",1)}}

Call it like this:
var s = "Horse^H^H^H^H^HCow"
f(&s)
print(s) // "Cow"


text:
Balancing Words
This challenge was posted on the DailyProgrammer subreddit, and I figured it would be a great candidate for a code golf challenge. Determining if a letter balances is based on its distance from the point of balance, and the letter's value. The value of a letter can be determined by either taking its one-indexed position in the alphabet, or by subtracting 64 from its ASCII value. Furthermore, the value of a letter is multiplied by its distance from the balance point. Let's take a look at an example, STEAD:
STEAD   -> 19, 20, 5, 1, 4 ASCII values
           This balances at T, and I'll show you why!
S T EAD -> 1*19 = 1*5 + 2*1 + 3*4
           Each set of letters on either side sums to the same value, so
           T is the anchor.

However, it should be noted that not all words balance. For example, the word WRONG does not balance in any configuration. Also, words must balance on a letter, not between two letters. For example, SAAS would balance if there was a letter in the middle of the two As, but since there is none it does not balance.
The Task
You should create a program or function that takes in an uppercase word as input or function arguments, and then produces one of two outputs:

If the word balances, then the word should be printed with the left side, a space, the anchor letter, another space, and the right side.
function (STEAD) -> S T EAD
If the word does not balance, you should print out the word, followed by DOES NOT BALANCE
function (WRONG) -> WRONG DOES NOT BALANCE

You may assume that all input will be uppercase and there will only be alpha characters.
Example I/O
function (CONSUBSTANTIATION) -> CONSUBST A NTIATION
function (WRONGHEADED)       -> WRO N GHEADED
function (UNINTELLIGIBILITY) -> UNINTELL I GIBILITY
function (SUPERGLUE)         -> SUPERGLUE DOES NOT BALANCE

This is code-golf, so the shortest answer in bytes wins.

Can we omit the spaces in the output of single letter words, e.g. function (A) -> A instead of -> A?

@nimi Yes, you may omit spaces.

Should single character input be considered balanced at all?

@someuser Yes, because the "weight" on either side is 0.

Is trailing whitespace allowed?

@Dennis A trailing newline is allowed.

BALANCE DOES NOT BALANCE

Pyth, 49 bytes
jd.xcz,Jhf!s*Vm-Cd64zr_TlzUzhJ,z"DOES NOT BALANCE

Demonstration.
Explanation:
jd.xcz,Jhf!s*Vm-Cd64zr_TlzUzhJ,z"DOES NOT BALANCE

                                    Implicit: z = input(), d = ' '
         f                Uz        Filter T over range(len(z)).
              m     z               Map the characters in z to
               -Cd64                their ASCII values - 64.
            *V                      Vectorized multiplication by
                     r_Tlz          range(-T, len(z)).
                                    This is equivalent to putting the fulcrum at T.
           s                        Sum the weights.
          !                         Logical not - filter on sum = 0.
        h                           Take the first result.
                                    This throws an error if there were no results.
       J                            Save it to J.
      ,J                    hJ      Form the list [J, J+1].
    cz                              Chop z at those indices,
                                    before and after the fulcrum.
  .x                                If no error was thrown, return the above.
                              ,z".. If an error was thrown, return [z, "DOES N..."]
jd                                  Join the result on spaces and print.

Pure bash (no coreutils or other utilities), 125
Standard center of mass calculation using moments about the origin:
for((;i<${#1};w=36#${1:i:1}-9,m+=w,M+=w*++i)){ :;}
((M%m))&&echo $1 DOES NOT BALANCE||echo ${1:0:M/m-1} ${1:M/m-1:1} ${1:M/m}

Test output:
$ for t in \
> STEAD \
> CONSUBSTANTIATION \
> WRONGHEADED \
> UNINTELLIGIBILITY \
> SUPERGLUE
> do ./wordbal.sh $t; done
S T EAD
CONSUBST A NTIATION
WRO N GHEADED
UNINTELL I GIBILITY
SUPERGLUE DOES NOT BALANCE
$

Python 3, 124
w=input()
i=a=b=0
for c in w:n=ord(c)-64;a+=n;b+=n*i;i+=1
m=b//a
print(*[w[:m],w,w[m],"DOES NOT BALANCE",w[m+1:]][b%a>0::2])

This code doesn't test potential fulcrums, but rather finds the "center of mass" and checks if it's an integer. It does so by summing the total mass a and the position-weighted mass b, to find the center of mass m=b/a. It then prints either the string split at position m, or the string plus "DOES NOT BALANCE", chosen by the [_::2] list-slicing trick.

CJam, 57 bytes
l_,,_f{f-W$'@fm.*:+}0#:I){ISIW$=S++t}" DOES NOT BALANCE"?

This can still be golfed a bit.
Try it online here

That fixes it. '@fm is shorter than 64f-:i.

Yeah.. forgot that CJam acts weird in case of char subtractions..

JavaScript (ES6), 211 200 160 bytes
f=w=>{for(j=-w.length;j++;)if(![...w].reduce((p,v,i)=>p+(parseInt(v,36)-9)*(j+i),0))return w.slice(0,-j)+` ${w[-j]} `+w.slice(1-j);return w+` DOES NOT BALANCE`}

Previous attempt, 200 bytes
Thanks to edc56 and nderscore for helping me golf this
f=w=>{for(j=0,r=(a,z)=>[...a][z||`reverse`]().reduce((p,v,i)=>p+(parseInt(v,36)-9)*++i,0);j++<w.length;)if(r(a=w[s=`slice`](0,j))==r(b=w[s](j+1),s))return a+` ${w[j]} `+b;return w+` DOES NOT BALANCE`}

Demo
Firefox and Edge only for now, as it is ES6

f=w=>{for(j=1-w.length;j++;)if(!([...w].reduce((p,v,i)=>p+(parseInt(v,36)-9)*(j+i),0)))return w.slice(0,-j)+` ${w[-j]} `+w.slice(1-j);return w+` DOES NOT BALANCE`}

// DEMO
console.log = function(a) {
  document.body.innerHTML += a + "<br>";
}

console.log(f('STEAD'));
console.log(f('CONSUBSTANTIATION'));
console.log(f('WRONGHEADED'));
console.log(f('UNINTELLIGIBILITY'));
console.log(f('SUPERGLUE'));

Try array comprehension [for(v of w)v.charCode....], it's usually 1 byte shorter than .map for strings

@edc65 Thanks! Learn something new every day

@edc65 array comprehension is technically pushed to the ES7 draft now :(

-1 byte: move j=0 inside the call to charCodeAt :)

C, 236 198 192 188 180 173 bytes
a,i,j,k,L;f(char*s){L=strlen(s);for(;i<L;i++){for(a=j=0;j<L;j++)a+=(s[j]-64)*(i-j);if(!a)break;}for(;k<L;k++)printf(k-i?"%c":" %c ",s[k]);if(a)printf(" DOES NOT BALANCE");}

Expanded with main():
#define p printf
a,i,j,k,L;
f(char*s)
{
    L=strlen(s);
    for(;i<L;i++){
        for(a=j=0;j<L;j++)
            a+=(s[j]-64)*(i-j);
        if(!a)
            break;
    }
    for(;k<L;k++)
        printf(k-i?"%c":" %c ",s[k]);
    if(a)
        printf(" DOES NOT BALANCE");
}
// 83 bytes below
int main(int argc, char **argv)
{
    f(argv[1]);
    printf("\n");
}

Verification:
$ ./a.out CONSUBSTANTIATION
CONSUBST A NTIATION
$ ./a.out WRONGHEADED
WRO N GHEADED
$ ./a.out A
 A
$ ./a.out WRONG
WRONG DOES NOT BALANCE
$ ./a.out SUPERGLUE
SUPERGLUE DOES NOT BALANCE

My solution was too similar to yours to post an answer, but I was able to get down to 146 chars: i,l=1,j;g(char*v){for(;v[i]&&l;++i)for(j=l=0;v[j];++j)l+=(i-j)*(v[j]-64);l?printf("%s DOES NOT BALANCE",v):printf("%.*s %c %s",--i,v,v[i],v+i+1);} Note: uses undefined behavior :)

I think you should post it anyway. I also realized that I should have get rid of my #define as it is wasting bytes.

I'm trying really hard to beat C with PHP but I'm still a byte off

CJam, 50 bytes
r_'@f-_ee::*:+\:+md"X DOES NOT BALANCEX"@?)/()@]S*

Using the Java interpreter, this exits with an error to STDERR for non-balancing words.
If you try the code in the CJam interpreter, just ignore everything but the last line of output.
Idea
My "original idea" turned out to be the same approach @xnor posted several hours before me. Nevertheless, here it goes:
Given a list of values (v0, … vn), we have that v_t is the anchor of the list if and only if any of the following, equivalent conditions holds:

tv0 + … + 1vt-1 == 1vt+1 + … tvn
(0 - t)v0 + … + (n - t)vn == 0
0v0 + … + nvn == t(v0 + … + vn)
t := (0v0 + … + nvn)/(v0 + … + vn) is an integer.

Code
r     e# Read a whitespace separated token from STDIN.
_'@f- e# Push a copy and subtract '@' from each char (pushes code point - 64).
_ee   e# Push a copy of the array of values and enumerate them.
::*   e# Multiply each value by its index.
:+    e# Add all results.
\:+   e# Add the unmodified values.
md    e# Perform modular division. Pushes quotient and residue.

"X DOES NOT BALANCEX"

@     e# Rotate the quotient on top of the string.
?     e# If the residue is 0, select the quotient. Otherwise, select the string.

At this part, we start having a little fun with overloaded operators.
For the quotient, this happens:
)     e# Add 1 to the quotient.
/     e# Split the input string into chunks of that length.
(     e# Shift out the first chunk.
)     e# Pop the last character of the first chunk.
@     e# Rotate the rest of the string on top of the stack.
]S*   e# Wrap all three parts in an array and join them, separating by spaces.

For the string, this happens:
)     e# Pop out the last char: "X DOES NOT BALANCE" 'X'
/     e# Split the remainder at X's: ["" " DOES NOT BALANCE"]
(     e# Shift out the first chunk: [" DOES NOT BALANCE"] ""
)     e# Pop out the last char.

At this point, a runtime error happens, since "" does not have a last char. The stack gets printed and executing is aborted immediately.

The code you linked seems different (and better?)

@aditsu: Oh, wrong link. It's shorter and cleaner, yes, but it has trailing spaces...

Julia, 122 bytes
s->(v=[int(i)-64for i=s];m=dot(v,1:length(s))/sum(v);m==int(m)?join([s[1:m-1],s[m],s[m+1:end]]," "):s*" DOES NOT BALANCE")

This creates an unnamed function that accepts a string as input and returns a string. To call it, give it a name, e.g. f=s->....
We treat the word like a one-dimensional system for which we need to find the center of mass. The center of mass is computed as the dot product of the masses with their locations, divided by the total mass of the system. If the computed center is an integer, it corresponds to one of the letters in the word. Otherwise the word doesn't balance.
Ungolfed + explanation:
function f(s)
    # Create a vector of ASCII code points -- these are the "masses"
    v = [int(i)-64 for i in s]

    # Compute the center of mass, taking the locations to be the indices
    m = dot(v, 1:length(s)) / sum(v)

    # Check whether the center corresponds to a letter's position
    if m == int(m)
        join([s[1:m-1], s[m], s[m+1:end]], " ")
    else
        m * " DOES NOT BALANCE"
    end
end

Examples:
julia> f("WRONG")
"WRONG DOES NOT BALANCE"

julia> f("STEAD")
"S T EAD"

julia> f("CONSUBSTANTIATION")
"CONSUBST A NTIATION"

PHP, 249 174 bytes
Takes one command-line argument.
<?for($i=-$l=strlen($w=$argv[1]);$i++;){for($k=$q=0;$l>$k;)$q+=($i+$k)*(ord($w[$k++])-64);$q?:exit(substr($w,0,-$i)." {$w[-$i]} ".substr($w,1-$i));}echo"$w DOES NOT BALANCE";

Initial attempt:
<?function r($a){for($i=$q=0;strlen($a)>$i;){$q+=(ord($a[$i])-64)*++$i;}return$q;}for($i=0;$i++<strlen($w=$argv[1]);)(strlen($w)<2?exit($w):(r(strrev($a=substr($w,0,$i)))==r($b=substr($w,$i+1)))?exit("$a {$w[$i++]} $b"):0);echo"$w DOES NOT BALANCE";

Haskell, 161 135 bytes
a#b=a*(fromEnum b-64)
v=sum.zipWith(#)[1..]
h![]=h++" DOES NOT BALANCE"
h!(x:y)|v(reverse h)==v y=h++' ':x:' ':y|1<2=(h++[x])!y
f=([]!)

Usage example:
*Main> putStr $ unlines $ map f ["CONSUBSTANTIATION","WRONGHEADED","UNINTELLIGIBILITY","SUPERGLUE"]
CONSUBST A NTIATION
WRO N GHEADED
UNINTELL I GIBILITY
SUPERGLUE DOES NOT BALANCE

How it works: f calls the helper function ! which takes two parameters, the left and right part of the word at a given position. It stops if both parts have equal weight (function v) or calls itself recursively with the first letter of the right part moved to the left. It ends with the DOES NOT BALANCE message if the right part is empty.

C, 183 134 bytes
h,i,a=1;c(char*s){for(;s[i++]&&a;)for(a=h=0;s[h];)a+=(s[h]-64)*(h++-i);printf(a?"%.*s DOES NOT BALANCE":"%.*s %c %s",i,s,s[--i],s+i);}

New Version Explained:
Like the other two entries, it makes use of constant addition on one side and subtraction on the other to hopefully reach zero which is the indication of balance. My original output is reused from the first answer, albeit slightly modified.
l,h,i,a,b;c(char*s){for(l=strlen(s);h++<l&&(a^b|!a);)for(i=a=b=0;i<l;i++)i==h?a=b,b=0:(b+=(s[i]-64)*abs(i-h));printf(a==b?"%.*s %c %s":"%.*s DOES NOT BALANCE",a==b?h:l,s,s[--h],s+h);}

Old Version Explained:
The first loop (h) is the main iterator for the length of the string. The second loop (i) accumulates (b) until h==i. Once that happens, (b) is stored in (a), reset to 0, and then continues until the end of the string is reached where (a) is compared to (b). If there's a match, the main iterator's loop is broken and the output is printed.

Ruby 175
F=->s{v=->s{(0...s.size).map{|i|(i+1)*(s[i].ord-64)}.inject :+}
r="#{s} DOES NOT BALANCE"
(0...s.size).map{|i|b,a=s[0...i],s[i+1..-1]
v[b.reverse]==v[a]&&r=b+" #{s[i]} "+a}
r}

Test it online: http://ideone.com/G403Fv
This is a pretty straightforward Ruby implementation. Here's the readable program:
F=-> word {
  string_value = -> str {
    (0...str.size).map{|i|(i+1) * (str[i].ord - 64)}.inject :+
  }

  result = "#{word} DOES NOT BALANCE"

  (0...word.size).map {|i|
    prefix, suffix = word[0...i], word[i+1..-1]
    if string_value[prefix.reverse] == string_value[suffix]
      result = prefix + " #{word[i]} " + suffix
    end
  }

  result
}

R, 190 bytes
As an unnamed function.  I think I can get a few more, but that'll have to wait.
function(A){D=colSums(B<-(as.integer(charToRaw(A))-64)*outer(1:(C=nchar(A)),1:C,'-'));if(!length(E<-which(B[,D==0]==0)))cat(A,'DOES NOT BALANCE')else cat(substring(A,c(1,E,E+1),c(E-1,E,C)))}

Ungolfed a bit with brief explanation
function(A){
D=colSums(  #column sums of the outer function * character values
    B<-(
       as.integer(charToRaw(A))-64)    # character values
       * outer(1:(C=nchar(A)),1:C,'-') # matrix of ranges eg -3:2, -1:4, etc
       )
if(!length(
    E<-which(B[,D==0]==0) # where the colsum = 0, get the index of the zero
    ))
    cat(A,'DOES NOT BALANCE')
else
    cat(substring(A,c(1,E,E+1),c(E-1,E,C)))  #cat the substrings
}

It doesn't put a newline at the end.
Test run
> f=
+ function(A){D=colSums(B<-(as.integer(charToRaw(A))-64)*outer(1:(C=nchar(A)),1:C,'-'));if(!length(E<-which(B[,D==0]==0)))cat(A,'DOES NOT BALANCE')else cat(substring(A,c(1,E,E+1),c(E-1,E,C)))}
>
> f('CONSUBSTANTIATION')
CONSUBST A NTIATION
> f('WRONGHEADED')
WRO N GHEADED
> f('UNINTELLIGIBILITY')
UNINTELL I GIBILITY
> f('SUPERGLUE')
SUPERGLUE DOES NOT BALANCE
>

C, 142 bytes
Credit to some user for beating me to it :)
i,l=1,j;g(char*v){for(;v[i]&&l;++i)for(j=l=0;v[j];++j)l+=(i-j)*(v[j]-64);printf(l?"%.*s DOES NOT BALANCE":"%.*s %c %s",l?i:--i,v,v[i],v+i+1);}

Java, 240 bytes
String b(String s){for(int i=-1,a=s.length(),l=0,r,m;++i<a;){for(r=i;--r>=0;l+=(s.charAt(r)-64));for(m=r=0;++m+i<a;r+=(s.charAt(m+i)-64)*m);if(l==r)return s.substring(0,i)+" "+s.charAt(i)+" "+s.substring(i+1);}return s+" DOES NOT BALANCE";}