text:
Where will your buddies sit?
You and some buddies are going bowling. There are a total of N bowlers. However, there are only N-1 chairs to sit in. The solution is simple: whoever's turn it currently is doesn't get a chair. Then when their turn is over, they sit in the chair of the person that goes next.
Lets take an example. Say You are named A, and your four friends are named B, C, D, and E. Every player moves in alphabetical order, so you get to go first. Since there are 5 players, there are only 4 seats. Your friends sit in the four seats in this order:

CEBD

You go, and yay you get a strike! It's B's turn next, so you sit in his chair. Now it looks like this:

CEAD

B goes. Gutterball! Then he sits in C's spot, and C goes next turn.

BEAD

then C sits in D's chair.

BEAC

and D sits in E's chair

BDAC

and lastly, E sits in your chair.

BDEC

You'll notice that now everybody's seat is (pseudo) shuffled. You must find out, after X turns, who will be sitting where?
Input
Your program must take two inputs from the user, a string and a number. No prompts are needed. The string will be 1-51 alphabetic characters (B-Z and a-z) with no repeats. This represents the order your friends chose to sit. There will be no uppercase A because that is you, and you always go first. The number will be the total number of rounds (not games) that you and your friends play. This number will be positive and reasonably sized (less than 1000).
Output
Your program must print out the order your friends are sitting in after X turns, and whose turn it is. So for example, if after X turns the order was BEDGCAHF and it was Z's turn, your program must print exactly this:
BEDGCAHF
It is Z's turn.

Here are a few sample input and outputs.
input: E, 4
E
It is A's turn.

input: E, 5
A
It is E's turn.

input: Bb, 2
AB
It is b's turn.

input: dgOPZXKDQYioHflFhpqzUsSaeILwckVNEtGTCJBvnruRyWMmjxb, 999
JNuvFDqjwEPVnMSlOWXgAZyGKordIRBtkamziphcUYbxfCsTQeH
It is L's turn.

Rules

Everybody goes in alphabetical order, with capital letters taking precedence over lower case.
This is code-golf, so standard loopholes apply, and submissions are scored in bytes.

I have spent hours working on this for brainflak. I just noticed that I was doing it wrong.

{({}[()])({}<({}<(([])<{{}({}<>)<>([])}{}<>>)<>>)<>{({}[()]<({}<>)<>>)}{}<>>)}

It shuffles it and the first item on stack is the answer.

That was my surprise for you :P

Pyth, 37 bytes
uXGK<.<+\ASzH2)QzpeK"It is ""'s turn.

Online Demonstration: Pyth Compiler/Executor
The algorithm is kinda based on @isaacg's solution. Like him I start with the initial seat-order and repeatedly use the replace-functionality of X to replace the next player with the current player.
But unlike his implementation, which replaces the char of the next player by the current player in the seating order, I use it in a more broad way. I replace each char of the current player by the next player and each char of the next player by the current player. This is accomplished by passing both players as second arg and omit the third arg (XG"ab") instead of XG"a""b"). Since the current player is not part of the string (he is playing), the first replacement has no effect at all. But it allows me to generate both players at the same time, while @isaacg has to generate them individually.
Another crazy new feature I use is the assignment operator. Until recently =N1 got translated into N = 1, which was executed with Python. But nowadays it compiles to assign('N',1). This function assigns N with 1 and returns the value (but doesn't print it). This allows saving intermediate results, which occur for instance in a reduce operation. Using this I was able to store the pair of players, which changed positions last, and print second player.
Detailed Explanation
                      implicit: z = input string, Q = input number
u              Qz     reduce for H in range(Q), start with G = z
                        update G with:
       +\ASz              "A" + sorted(z)
     .<     H             cyclic shifted by H
    <        2            get the first 2 elements (current + next player)
   K                      store the result in K
 XG           )           replace next player by current player in G
                      implicit print

peK"It is ""'s turn.  print "It is" + K[-1] (current player) + "'s turn."

Pyth, 39 38 bytes
L@+\ASzbuXGyhHyHQzpyQ"It is ""'s turn.

This is based around repeated applications of the find and replace operation, X. The first bit defines a lookup function, y, which finds the bth player in the player order. Then, we repeatedly perform substitutions to find the final seating order, and finally print out whose turn it is.
Amusingly, the code to find the final seating order is shorter (18 bytes) than the code to print whose turn it is (21 bytes).
The code takes the seating string on the first line of STDIN, and the number of turns on the second.
Demonstration.
Explanation:
L@+\ASzbuXGyhHyHQzpyQ"It is ""'s turn.
                                          Implicit:
                                          z = input()
                                          Q = eval(input())

L                                         def y(b): return
  +\ASz                                    "A" + sorted(z)
 @     b                                  (               )[b]
        u       Qz                        reduce for H in range(len(Q)),
                                          G starts as z.
         XGyhHyH                          replace in G y(H+1) with y(H).
                  pyQ"It is ""'s turn.    Print out whose turn it is.

@Sp3000 Thanks for the catch.

Never use %, if you only insert one thing. Even ++ would save one byte, but the best way (2 bytes) is using p: pyQ"It is ""'s turn

Oops. Missed the point at the end. So ++ has the same byte-count as %, and p only saves 1 byte.

CJam, 49 45 43 bytes
l_'A+$ri{:L2<(erL(+}*1<"
It is "\"'s turn."

I think this works. It just runs the algorithm as is.
Try it online.
Explanation
l                       Read line (initial seating order)
_'A+$                   Copy, add "A" and sort to give bowling order

ri{          }*         Do <number of turns> times...
   :L                     Save bowling order as L
     2<(                  Get next and current bowlers
        er                Replace next with current in seating
          L(+             Push bowling order again and update (rotate)

1<                      Get current bowler from start of bowling order
"
It is "\"'s turn."      Output message

Python 3, 110
s=input()
S=sorted(s+'A')*999
exec("y,*S=S;s=s.replace(S[0],y);"*int(input()))
print(s+"\nIt is %s's turn."%y)

An optimized version of Sp3000's solution using replace. The list S cycles though the letters present in order. We perform repeated replacements in the given string of each character of S by the previous one.

Well played, every time :)

@Sp3000 I used your solution though.

Clip 10, 59 56 bytes
[t{)k[qa)qglqtg(lqt}wx)nyN"It is "gnyt"'s turn.."`]s,x'A

Example
[t{)k[qa)qglqtg(lqt}wx)nyN"It is "gnyt"'s turn.."`]s,x'A
dgOPZXKDQYioHflFhpqzUsSaeILwckVNEtGTCJBvnruRyWMmjxb
999
JNuvFDqjwEPVnMSlOWXgAZyGKordIRBtkamziphcUYbxfCsTQeH
It is L's turn.

Explanation
The first input is the list of players, assigned to the variable x.
The second input is the number of turns, which the program obtains with ny.
[t                                        ]s,x'A .-t is the sorted list of players including A-.
  {                                      `       .-Print the following:            -.
    k[q            }wx)ny                        .-In each round (q is all the previous rounds)-.
       a)q                                       .-Replace                         -.
          glqt                                   .-the next player                 -.
              g(lqt                              .-with the previous player        -.

                     N                           .-Also print a newline            -.
                      "It is "    "'s turn.."
                              gnyt               .-The ny'th player in t           -.

Thanks to Sp3000 for the idea of using "replace".

Python 3, 128 bytes
L=input()
S=sorted(L)+["A"]
i=0
exec("L=L.replace(S[i],S[i-1]);i=-~i%len(S);"*int(input()))
print(L+"\nIt is %s's turn."%S[i-1])

Takes two lines of input via STDIN — initial seating order then number of turns.
This is basically the same search-and-replace idea as my CJam solution. The only tricky part is that we stick A at the back of the bowling order and make our index i the index of the next bowler, thus taking advantage of indexing by -1 and avoiding IndexErrors.
This is a few bytes shorter in Python 2, but I'm posting Python 3 for comparison with OP's solution.

What improvements does python 2 have? I see that input on line 1 becomes raw_input (+4) and int(input()) on line 4 becomes input (-4) so that cancels out. Then remove parentheses from print and add a space for a total of 127. Am I missing something?

@DJMcMayhem You forgot the parentheses for exec

JavaScript (ES6) 116
116 bytes as program with I/O via popup window. 114 as a testable function.
Run code snippet in Firefox to test.

// as a program with I/O
for(t=[...s=(P=prompt)()].sort(),x=P(),p='A';x--;p=n)t.push(p),s=s.replace(n=t.shift(),p);P(`${s}
It is ${p}' turn`)

// as a function with 2 parameters, returning output as a 2 lines string
f=(s,x)=>{for(t=[...s].sort(),p='A';x--;p=n)t.push(p),s=s.replace(n=t.shift(),p);return(`${s}
It is ${p}' turn`)}

// Test suite
test=[
['CEBD',5], ['E', 4],['E',5],['Bb', 2],
['dgOPZXKDQYioHflFhpqzUsSaeILwckVNEtGTCJBvnruRyWMmjxb', 999]];

Out=x=>OUT.innerHTML=OUT.innerHTML+x;

test.forEach(([p,x])=>Out(p+' '+x+':\n'+f(p,x)+'\n'))
Test cases from OP:

PowerShell, 168 bytes
function x($s,$t){$p="A"+$s-split''|?{$_}|%{[int][char]$_}|sort|%{[char]$_};$l=$p.count;1..$t|%{$s=$s.replace($p[$_%$l],$p[($_-1)%$l])};$s;"It is $($p[$t%$l])'s turn."}

I've decided all my answers on this site will be in PowerShell. One day I'll have an answer that can compete...
call the function like this: x Bb 2

This answer isn't going to win, but I'll throw it out there anyway.
Python 3, 167 bytes
s=input()
n=int(input())
c='A'
t=sorted(set(s+c))
F=len(t)
f=list(s)
for i in range(n):
 I=f.index(t[(i+1)%F]);c,f[I]=f[I],c
print(''.join(f)+'\nIt is '+c+"'s turn.")

Pip, 54 bytes
Not very competitive, but at least I get to show off Pip's mutable strings and the Swap command. Takes the seating order and number of rounds as command-line arguments (which get assigned to a and b, respectively).
u:'Ao:SN A^u.aLbSu(aa@?C(o++i))Pa"It is ".u."'s turn."

Explanation:
u:'A                   u = player who's currently up

o:SN A^u.a
      ^u.a             Append "A" to the seating order, split into list of characters
o:SN A                 ASCII value of each char, sort the resulting list, assign to o

LbSu(aa@?C(o++i))
Lb                     Repeat b times:
  Su                   Swap u with:
    (a          )      The character of a at index:
      a@?              Find in a:
         C(o++i)       chr(ASCII value of next player from o)
                       (Subscripts wrap around, as in CJam, so no need for mod)

Pa                     Print the final lineup
"It is ".u."'s turn."  Current player (auto-printed)

It would have been 49 if I'd bothered to implement SS (sort as strings) at the same time I did SN (sort numeric)... Ah well, the perils of having a language in development.

Python 2, 105 bytes
a,s='A',input()
exec"b=a<max(s)and min(e for e in s if e>a)or'A';s=s.replace(b,a);a=b;"*input()
print s,b

Try it online!
Golf of:
s=input()
n=input()
a='A'
for i in range(n):
 try:
  b=min(e for e in s if e>a)
 except:
  b='A'
 s=s.replace(b,a)
 a=b
print s
print b

Perl 5, 102 + 1 (-n) = 103 bytes
s/\d+//;$t=$&;@p=sort'A',split//;for$i(1..$t){s/$p[$i%@p]/$p[--$i%@p]/}say"$_
It is $p[$t%@p]'s turn."

Try it online!
Input
Seating order, followed by number of turns without spaces:
SEatingOrder###


text:
Is that word Feminine or Masculine?
Write a program or function that takes in a single string containing only lowercase a-z, and prints or returns a truthy value if the word is the feminine version of the thing it represents and a falsy value if it is the masculine version. For example, hen is the feminine version for chicken and rooster is the masculine version, so hen might produce 1 and rooster might produce 0.
Doing this for all English words that reflect gender would of course be way too unwieldy. Your program/function only needs to support 20 masculine/feminine pairs. Below are five sets of 10 masculine/feminine pairs, categorized by topic. Choose any two of the sets; the 20 total pairs in these two sets are the 40 words your program/function must work for.
(format is masculine_version feminine_version)

General
he she
him her
man woman
boy girl
male female
masculine feminine
guy gal
lad lass
mister miss
sir madam

Familial
father mother
dad mom
pa ma
son daughter
brother sister
husband wife
grandfather grandmother
grandpa grandma
uncle aunt
nephew niece

Animal
lion lioness
rooster hen
stallion mare
bull cow
drake duck
boar sow
buck doe
ram ewe
gander goose
billy nanny

Royal
king queen
prince princess
emperor empress
duke duchess
marquess marchioness
earl countess
baron baroness
baronet baronetess
lord lady
knight dame

Fantastical
wizard witch
giant giantess
incubus succubus
nidorino nidorina
nidoking nidoqueen
ents entwives
hanuvoite inimeite
centaur centaurides
merman mermaid
khal khaleesi

So, for example, you might choose the General and Familial categories. Then any input from he to sir or father to nephew would produce a falsy value, and any input from she to madam or mother to niece would produce a truthy value.
The values don't all have to be the same truthy/falsy type, e.g. he might produce 0 but sir might produce false. You may assume only the 40 specific lowercase a-z words from your two selected categories are ever input.
The shortest answer in bytes wins. Tiebreaker is earlier post.
(This challenge is not meant to correlate with or make statements about any current gender-based social issues.)

Related.

Shouldn't count be the masculine of countess?

@mbomb007 Not necessarily.

Three answers, all Retina.

Retina, 26 bytes (sets 4, 5)
[^u]es|ee|m.i|y|^...c|d.*a

Retina is @MartinBüttner's regex language. I haven't used anything specific to .NET regexes, so you can test the regex at Regex101 here. Alternatively you can use Retina's grep G mode like so:
G`[^u]es|ee|m.i|y|^...c|d.*a

and pipe in a file with one word per line for batch testing.
Retina outputs the number of matches by default, giving us our truthy/falsy value. The rule "the values don't all have to be the same truthy/falsy type" is pretty important though since marchioness matches twice, giving an output of 2.
(Using the mod-chaining method from the previous male/female question seems to be shorter in CJam, but I'll let someone else do that)

time is never wasted on a regular expression

Retina, 39 32 bytes (sets 2, 4)
Accounting for marquess was annoying, since using ma was the best way to get some of the feminines.
[^u]es|ma$|mo|y|[mie]e|wi|ter|au

Try it here
Thanks to Sp3000 for his golf suggestion.

With a little rearranging

@Sp3000 Ah, thanks. I hadn't noticed I could use $ for that.

Retina, 28 bytes (sets 3,4)
w|[mhorse]e|[^u]es|duc|[dn]y

Retina uses .NET regex, but any flavor should work. Test it at Regex101.

source: Stack Exchange

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

sort: votes


text:
StickStack Numbers
StickStack is a very simple stack-based programming language with only two instructions:

| pushes the length of the stack onto the stack
- pops the top two elements from the stack and pushes back their difference (second topmost - topmost)

Language details

The stack is empty at the start of the program.
All instructions are executed sequentially from left to right.
If there are less than 2 numbers on the stack the - instruction is illegal.
At the end of the execution the stack should contain exactly one number.

Any integer can be generated by a StickStack program. For example:
|||--||-- generates the number 2 through the following stack states:

[]
[0]
[0, 1]
[0, 1, 2]
[0, -1]
[1]
[1, 1]
[1, 1, 2]
[1, -1]
[2]

To evaluate your StickStack code you can use this online (CJam) evaluator. (Thanks for @Martin for the code.)
The task
You should write a program or function which given an integer number as input outputs or returns a string representing a StickStack program which outputs the given number.
Scoring

Your primary score is the total length of the StickStack programs for the below given test cases. Lower score is better.
Your submission is valid only if you ran your program on all the test cases and counted your score.
Your secondary (tiebreaker) score is the length of your generating program or function.

Input test cases
(Each number is a different test case.)
-8607 -6615 -6439 -4596 -4195 -1285 -72 12 254 1331 3366 3956 5075 5518 5971 7184 7639 8630 9201 9730

Your program should work for any integers (which your data-type can handle) not just for the given test cases. The solutions for the test numbers should not be hardcoded into your program. If there will be doubt of hardcoding the test numbers will be changed.

I suggest adding a clause that says "And runs in a reasonable amount of time" to prevent brute-force.

@Reticality that's implied in "valid only if you ran your program on all the test cases"

Python 2 - 5188
Quite efficient time-wise, and seems to be (probably) the optimal solution. I observed that a pattern such as
|||||-|||-|-|-|------ (an optimal solution for 25)
can be delineated as
 0  |
-1  |
+2   |                 -
-3    |               -
+4     | |           -
-5      - |         -
+6         | | | | -
-7          - - - -

where each the total value at the end is the sum of (each level's value times the number of '|'s ). So for example above, we have -1*1 + 2*1 - 3*1 + 4*2 - 5*1 + 6*4 = 25. Using this I wrote this solution which produces similar output to other answers, and in a trivial amount of time.
I believe this is the optimal solution, as I test every possible optimal height (I actually test many more than necessary) and I'm pretty sure the solution always involves at most one layer with two '|'s besides the last (I can guarantee this for positive numbers but not 100% sure about negatives).
def solution(num):
    if num == 0:
        return '|'

    neg = num<0
    num = abs(num)
    high = int(num**0.5)

    def sub(high):
        counts = [1]*high
        total = num - (high+neg)/2

        if total%high == 0:
            counts[-1] += total/high
        else:
            counts[-1] += total/high
            if (total%high)%2==1 and not neg:
                counts[-1] += 1
                counts[-(total%high)-1] += 1
            elif (total%high)%2==0 and neg:
                counts[(total%high)-2] += 1
                counts[0] += 1
            else:
                counts[total%high-1] += 1

        string = ""
        for c in counts[::-1]:
            string = '|-'*(c-1)+'|'+string+'-'
        return '|'+string

    return min((sub(h) for h in range(2-neg,2*high+2,2)), key=lambda s: len(s))

Here is the code I used to test it
string = "-8607 -6615 -6439 -4596 -4195 -1285 -72 12 254 1331 3366 3956 5075 5518 5971 7184 7639 8630 9201 9730"
total = 0

def string_to_binary(string):
    total = 0
    for i,char in enumerate(string[::-1]):
        total += (char=='|')*(2**i)
    return total

def stickstack(bits,length):
    stack = []
    for i in range(length):
        d,bits = divmod(bits,2**(length-i-1))
        if d == 1:
            stack.append(len(stack))
        else:
            stack[-2] -= stack[-1]
            stack = stack[:-1]
    return stack

for num in string.split():
    s = solution(int(num))
    print '%s:' % num
    print s
    result = stickstack(string_to_binary(s),len(s))
    print 'Result: %s' % result
    print 'Length: %s' % len(s)
    total += len(s)
    print

print 'Total length: %s' % total

Great solution! I believe the score is optimal (based on my bruteforce calculation) and based on your description I think your algorithm always gives the best solutions.

@randomra I think its likely that it is, but I was only brute forced up to about +/-100 so I wasn't ready to say that it was necessarily the best, but now that I think about it I can't see how it could be done any better.

+1 very nice. How can I try it? What pyton? (I'm not a pythonist, I just have accidentaly a python 3.4 installed on my laptop).

@edc65 I added code to test it; also this is using Python 2.7, so things like the print statements won't work with Python 3

For what it's worth, I can confirm that this result is optimal: i tried a brute force solution (a BFS indeed), verifying up to a length of 450 (and still running). Same results yours.

Java, 5208 5240 5306 6152
This is a recursive function that edges closer to the target, with base cases for when it gets within 5 (which is often only one step).
Basically, you can get (a*b)+(a/2) for (a+b)*2 sticks with a simple pattern. If a is odd, the result will be negative, so that leads to some weird logic.
This takes a minute or so for 231-1, with a length of 185,367 as the result. It works almost instantly for all test cases, though. It scores 4*(sqrt|n|) on average. The longest individual test case is 9730, which results in a 397-length stick stack:
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||-|||||||||||||||||||||-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|--------------------------------------------------------------------------------------------------|-

Update:
Found a shorter way to add/subtract from the basic pattern. Back in the lead (for now)!

With a harness and test cases:
import static java.lang.Math.*;

public class StickStacker {

    public static void main(String[] args){
        StickStacker stacker = new StickStacker();
        int tests[] = {-8607,-6615,-6439,-4596,-4195,-1285,-72,12,254,1331,3366,3956,5075,5518,5971,7184,7639,8630,9201,9730};
        int sum = 0;
        for(int test : tests){
            String sticks = stacker.stickStack3(test);
            sum += sticks.length();
            System.out.println("In: " + test + "\t\tLength: " + sticks.length());
            System.out.println(sticks+"\n");
        }
        System.out.println("\n\nTotal: "+sum);
    }

    String stickStack3(int n){return"|"+k(n);}
    String k(int n){
        String o="";
        int q=(int)sqrt(abs(n)),a,b,d=1,e=0,c=1<<30,
        z[]={232,170,42,10,2,0,12,210,52,844,212};
        a=n>0?q:-q;
        a-=n>0?a%2<1?0:1:a%2<0?0:-1;

        for(b=0;b<abs(a)+10;b++)
            if(abs(n-(a*b+a/2-(n>0?0:1)))<abs(a)&&abs(a)+b<c){
                    c=abs(a)+b;
                    d=a;e=b;
            }

        for(a=0;a++<e;)o+="-|";
        for(a=0;a++<abs(d);)o="|"+o+"-";

        c=n-(d*e+d/2-(n>0?0:1));
        if(c>0&&c<abs(d)){
            if(c%2==0)
                o=o.substring(0,c)+"-|"+o.substring(c);
            else
                o=o.substring(0,c+1)+"-|"+o.substring(c+1)+"|-";
            c=0;
        }else if(c<0&-c<abs(d)){
            if(c%2!=0)
                o=o.substring(0,-c)+"-|"+o.substring(-c);
            else
                o=o.substring(0,-c-1)+"-|"+o.substring(-c-1)+"|-";
            c=0;
        }

        return n==0?"":n<6&&n>-6?
                Long.toBinaryString(z[n+5])
                .replaceAll("0","-")
                .replaceAll("1","|"):
                o+k(c);
    }
}

Will golf (more) in the unlikely event of an exact tie.

Are you sure about your score for 2^31? My score for 2^30 is 131099, and 185369 for 2^31-1.

@edc65 I must have typed it in wrong. I thought it seemed a bit low... Anyway, thanks for noticing, and giving some competition. Now it's time to see if I can do better :)

JavaScript (ES6) 5296 6572
Edit As I said in my explanation, I'm not good at solving integer equations. My guess of b value was not so good, so I have widened the range of values to try. And (wow) I'm leading by now.
Edit 2 Bug fix, same results. I have an idea, but cant't nail it down.
Bytes: ~460, quite golfed. It works on 32 bit integers, run time near 0.
The code is the F function (hidden in the snippet) below.
Run the snippet to test (in FireFox).

F=n=>{
  l=1e8;
  v=Math.sqrt(n>0?n:-n)/2|0;
  p='|';
  if (n)
    for(b=v>>2|1;b<=v+v+9;b++)
    [w=n>0?(n-b)/(2*b)|0:(-n-b)/(2*b-1)|0,w+1].map(r=>(
      t=2*r*b+b, d=n-t, n<0?t=r-t:0,
      q=n>0?'|'.repeat(2*b+1)+'-|'.repeat(r)+'-'.repeat(2*b)
      :'|'.repeat(2*b)+'-|'.repeat(r)+'-'.repeat(2*b-1),
      q+=t<n?'||--'.repeat(n-t):'|-'.repeat(t-n),
      m=q.length,m<l&&(l=m,p=q)
    ))
  return p
}

// Test --------------------------------------------

FreeTest=_=>{var n=IN.value|0,s=F(n)
  LEN.value=s.length,CK.value=Check(s),ST.innerHTML=s}
Check=t=>{var s=[],a,b;
  [...t].forEach(c=>c=='|'? s.push(s.length):(b=s.pop(),a=s.pop(),s.push(a-b)))
  return s.pop()}

ot=[];
tot=0;
[-8607,-6615,-6439,-4596,-4195,-1285,-72,
 12,254,1331,3366,3956,5075,5518,5971,7184,7639,8630,9201,9730]
.forEach(x=>{
  s=F(x), k=Check(s), l=s.length, tot+=l,
  ot.push(`<tr><td>${x}</td><td>${l}</td><td>${k}</td><td class='S'>${s}</td></tr>`)
})
ot.push(`<tr><th>Total:</th><th>${tot}</th></tr>`)
TOUT.innerHTML=ot.join("")
td.S { font-size: 8px; font-family: courier}
pre { font-size: 8px; }
input { width: 6em }
Free test: <input id="IN" value=1073741824>
<button onclick="FreeTest()">-></button>
Len:<input readonly id="LEN"> Check:<input readonly id="CK">

Number	Len	Check	Sticks

Explanation
Positive numbers, to begin with.
Start with a "base" (try in CJam if you like, spaces allowed)
| gives 0
||| -- gives 1
||||| ---- gives 2
||||||| ------ gives 3

Summary: 1 stick, then b*2 sticks, then b*2 dashes
Then try adding one or more '-|' in the middle split. Each one add a fixed increment that is two time the starting base and can be repeated many times.
So we have a formula, with b=base and r=increment repeat factor
v=b+r*2*b

b=1, r=0 to 3, inc=2
| || -- 1
| || -| -- 3
| || -| -| -- 5
| || -| -| -| -- 7

b=3, r=0 to 3, inc=6
| |||||| ------ 3
| |||||| -| ------ 9
| |||||| -| -| ------ 15
| |||||| -| -| -| ------ 21

See? The addes value increases quicky and each addition still is only 2 chars. The base increment gives 4 more chars each time.
Given v and our formula v=b+r*2*b, we need to find 2 ints b and r. I'not an expert in this kind of equation, but b=int sqrt(v/2) is a good starting guess.
Then we have an r and b that together give a value near v. We reach v exactly with repeated increment (||--) or decrement (|-).
Follow the same reasoning for negative numbers, alas the formula is similar but not equal.

Python, 398710 (71 bytes)
Simplest possible solution, I think. Uses 4*n (+/-1) characters of stickstack to represent n.
def s(n):return'|'*(n*2+1)+'-'*n*2 if n>=0 else'|'*(n*-2)+'-'*(n*-2-1)

JavaScript, 398710
94 bytes/chars of code
I came up with a solution! ... and then read Sparr's answer and it was exactly the same.
Figured I would post it anyway, as js allows for slightly fewer chars.
Here's an unminified version of the code:
function p(a){
    s = "";
    if(a<=0){
        for(i=0; i<-2*a-1;i++)
            s="|"+s+"-";
        return "|"+s;
    }
    return "|"+p(0-a)+"-";
}

ok, if we're golfing the 398710 solutions, game on!
someone will come through with cjam or pyth and beat us both, though :(

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


text:
List all times in the day at a half hour rate
Shortest answer wins.
It must be sorted, and in 24hr time. The final line does not have a comma.
Output should be as follows:
'00:00',
'00:30',
'01:00',
'01:30',
'02:00',
'02:30',
'03:00',
'03:30',
'04:00',
'04:30',
'05:00',
'05:30',
'06:00',
'06:30',
'07:00',
'07:30',
'08:00',
'08:30',
'09:00',
'09:30',
'10:00',
'10:30',
'11:00',
'11:30',
'12:00',
'12:30',
'13:00',
'13:30',
'14:00',
'14:30',
'15:00',
'15:30',
'16:00',
'16:30',
'17:00',
'17:30',
'18:00',
'18:30',
'19:00',
'19:30',
'20:00',
'20:30',
'21:00',
'21:30',
'22:00',
'22:30',
'23:00',
'23:30'

Is this 24 hour time? Could you please provide the entire output?

Must the output be sorted?

Yes. It must be sorted, and in 24hr time. Sorry will update.

Does the final line have a comma?

Final line does not have a comma :)

Can we use a double quote instead of single ?

What if it takes my program 23.5 hours to run?

I can't see why that would be a negative.

@tfitzger I had a go at doing that - it was 40+ more chars!

what about daylight saving, leap seconds etc?

Just a small suggestion about upvotes. I try to upvote every valid answer to a challenge I create as a small reward for taking the effort. I have plenty of rep and don't really need an upvote here, but please consider other answerers who may give up responding if their answers are ignored after lots of hard thinking and debugging.

Taking a next step: there is an emoji for each time at a half hour rate

Pyth, 26 bytes
Pjbm%"'%02d:%s0',"d*U24"03

Demonstration.
We start with the cartesian product of range(24) (U24) with the string "03".
Then, we map these values to the appropriate string formating substitution (m%"'%02d:%s0',"d).
Then, the resultant strings are joined on the newline character (jb).
Finally, we remove the trailing comma (P) and print.

Looks like we have a new contender for the prize. Author of pyth, that's almost cheating ;)

Befunge-93, 63 bytes
0>"'",:2/:55+/.55+%.":",:2%3*v
 ^,+55,","<_@#-*86:+1,"'".0. <

(animation made with BefunExec)

Bash: 58 47 46 characters
h=`echo \'{00..23}:{0,3}0\'`
echo "${h// /,
}"

I like this solution :)

Anonymous user suggested echo \'{00..23}:{0,3}0\'|sed 's/ /,\n/g' of 40 characters. Nice. Thanks. But I prefer to make use of bash's own strength.

printf "'%s',\n" {00..23}:{0,3}0

@manatwork oh i didn't read the question well, sorry...

printf "'%s'\n" {00..23}:{0,3}0|sed $\!s/$/,/  is 45 bytes

Or even 44 if you include a literal line break in the format string instead of \n. Nice, but I prefer my bash solutions to be pure bash as possible.

CJam, 31 30 29 bytes
24,[U3]m*"'%02d:%d0',
"fe%~7<

This is pretty straight forward using printf formatting:
24,                              e# get the array 0..23
   [U3]                          e# put array [0 3] on stack
       m*                        e# do a cartesian product between 0..23 and [0 3] array
                                 e# now we have tuples like [[0 0], [0 3] ... ] etc
         "'%02d:%d0',
"fe%                             e# this is standard printf formatting. What we do here is
                                 e# is that we format each tuple on this string
    ~7<                          e# unwrap and remove comma and new line from last line
                                 e# by taking only first 7 characters

Try it online here

Looks like this is going to take the gold. We'll give it until tomorrow ;)

@EspenSchulstad I wish it would actually give me some gold. sigh

Remember, it's not only viritual gold, but also honor. What we do in life echoes in eternity.

Python 2, 58 56 bytes
for i in range(48):print"'%02d:%s0',"[:57-i]%(i/2,i%2*3)

Like sentiao's answer but using a for loop, with slicing to remove the comma. Thanks to @grc for knocking off two bytes.

Would this work: "'%02d:%s0',"[:57-i]

@grc Ahaha of course, that's much better

Better than I could do!

Java - 119 bytes
I started with Java 8's StringJoiner, but that means including an import statement, so I decided to do it the old way:
void f(){String s="";for(int i=0;i<24;)s+=s.format(",\n'%02d:00',\n'%02d:30'",i,i++);System.out.print(s.substring(2));}

Perhaps this can be improved by getting rid of the multiple occuring String and System keywords.

a version in groovy perhaps :)

You can shorten this to 159: Remove the space before a, move the i increment, lose the for braces, and move the comma/newline to the beginning (which lets you use the shorter substring and get rid of length()). Since functions are allowed by default, you can get make it even shorter by eliminating boilerplate: void f(){String s="";for(int i=0;i<24;)s+=String.format(",\n'%02d:00',\n'%02d:30'",i,i++);System.out.print(s.substring(2));} Even a bit more if you make it just return the string instead of printing it, but that seems to go against the spirit, if not the letter.

Damn, that's brilliant! I got to keep those tricks in mind, thanks!

Oh, another few: change String.format to s.format. Your compiler/IDE may complain about it, but it works ;)

Nice one! format's a static method, so it should be accessed by its class, but indeed, using it this way also works!

Ruby, 94 61 56 51
$><<(0..47).map{|i|"'%02d:%02d'"%[i/2,i%2*30]}*",
"

Thanks to @blutorange (again) for his help in golfing!

You can reduce that to 61 bytes: puts (0..47).to_a.map{|h|"'%02d:%02d'"%[h/2,h%2*30]}.join"," (there's a newline after the last comma)

Thank you again! I really didn't try it much...

Ruby needs some love. 58 bytes ;) puts Array.new(48){|i|"'%02d:%02d'"%[i/2,i%2*30]}.join','

@blutorange @rcrmn you can reduce 4 more bytes (and get to my solution below :)) ) by replacing .join with * :)

Perl, 52 50 48 45B
$,=",
";say map<\\'$_:{0,3}0\\'>,"00".."23"

With help from ThisSuitIsBlackNot :)

JAVA 95 94 bytes
I love the fact that printf exists in Java:
void p(){for(int i=0;i<24;)System.out.printf("'%02d:00',\n'%02d:30'%c\n", i,i++,(i<24)?44:0);}

Ungolfed
void p(){
    for(int i=0;i<24;)
        System.out.printf("'%02d:00',\n'%02d:30'%c\n", i,i++,(i<24)?44:0);
}

EDIT
Replaced the ',' with 44

24.times{printf("'%02d:00',\n'%02d:30'%c\n",it,it,(it<24)?44:0)} in groovy :) same solution, just that it's down to 65 chr

@EspenSchulstad Would that be considered a standalone function, or is there other boilerplate that would be needed to get it to run?

If you have groovy, you could either run that in groovysh or just as a groovy script in a .groovy-file. then you don't need no function.

http://groovyconsole.appspot.com/edit/24001

@EspenSchulstad Interesting. I've only done minimal work with Groovy.

Pyth, 32 31 bytes
I golfed something in python but it turned out to be exactly the same as Sp3000's answer. So I decided to give Pyth a try:
V48<%"'%02d:%d0',",/N2*3%N2-54N

It's a exact translation of Sp3000 answer:
for i in range(48):print"'%02d:%d0',"[:57-i]%(i/2,i%2*3)

It's my first go at Pyth, so please do enlighten me about that 1 byte saving.

Nicely done, and welcome to Pyth.

Ruby, 54 51 bytes
puts (0..23).map{|h|"'#{h}:00',
'#{h}:30'"}.join",
"

You can reduce 3 bytes by changing \n to actual newlines and removing the space between join and ". On the other hand, take note that the specified output has leading zeros for the hours.

Also, some more bytes by changing puts  to $><< (without space) and .join with *. You still have the leading zero problem for the hours, though.

PHP, 109 bytes
foreach(new DatePeriod("R47/2015-05-07T00:00:00Z/PT30M")as$d)$a[]=$d->format("'H:i'");echo implode(",\n",$a);

C, 116,115,101,100,95,74,73, 71
May be able to scrape a few more bytes off this...
main(a){for(;++a<50;)printf("'%02d:%d0'%s",a/2-1,a%2*3,a<49?",\n":"");}

You can save 3 bytes by creating a function rather than a complete program. Just replace "main" with "f", or whatever your favourite letter is.

Oh thats a very nice suggestion.....one I always forget!

Suggest a/49*2+",\n" instead of a<49?",\n":""

It's from  3 years ago - I'm not updating it.

T-SQL, 319 307 305 bytes
WITH t AS(SELECT t.f FROM(VALUES(0),(1),(2),(3),(4))t(f)),i AS(SELECT i=row_number()OVER(ORDER BY u.f,v.f)-1FROM t u CROSS APPLY t v),h AS(SELECT i,h=right('0'+cast(i AS VARCHAR(2)),2)FROM i WHERE i<24)SELECT''''+h+':'+m+CASE WHEN i=23AND m='30'THEN''ELSE','END FROM(VALUES('00'),('30'))m(m) CROSS APPLY h

Un-golfed version:
WITH
t AS(
    SELECT
        t.f
    FROM(VALUES
         (0),(1),(2),(3),(4)
    )t(f)
),
i AS(
    SELECT
        i = row_number() OVER(ORDER BY u.f,v.f) - 1
    FROM t u
    CROSS APPLY t v
),
h AS(
    SELECT
        i,
        h = right('0'+cast(i AS VARCHAR(2)),2)
    FROM i
    WHERE i<24
)
SELECT
    '''' + h + ':' + m + CASE WHEN i=23 AND m='30'
                              THEN ''
                              ELSE ','
                         END
FROM(
    VALUES('00'),('30')
)m(m)
CROSS APPLY h

Pyth, 34 bytes
j+\,bmjk[\'?kgd20Z/d2\:*3%d2Z\')48

This can definitely be improved.
Try it online: Pyth Compiler/Executor
Explanation:
     m                          48   map each d in [0, 1, ..., 47] to:
        [                      )       create a list with the elements:
         \'                              "'"
           ?kgd20Z                       "" if d >= 20 else 0
                  /d2                    d / 2
                     \:                  ":"
                       *3%d2             3 * (d%2)
                            Z            0
                             \'          "'"
      jk                               join by "", the list gets converted into a string
j+\,b                                join all times by "," + "\n"

Always impressive with these golfing languages :) I do somehow appreciate it more when it's done in a non-golfing language.  Does anyone know if there is a golf-jar-lib to java for instance?

Obligatory port of sentiao's gives 31: j+\,bm%"'%02d:%s0'",/d2*3%d2 48 with string formatting

Swift, 74 bytes
Updated for Swift 2/3...and with new string interpolation...
for x in 0...47{print("'\(x<20 ?"0":"")\(x/2):\(x%2*3)0'\(x<47 ?",":"")")}

The final line is specified to not have a comma & your code prints it.

Python 2, 69 bytes
print',\n'.join(["'%02d:%s0'"%(h,m)for h in range(24)for m in'03'])

Quite obvious, but here's an explanation:

using double-for-loop
alternating between '0' and '3' in string format is shorter than a list
%02d does the padding for h
mdoesn't need padding as the alternating character is on a fixed position
'\n'.join() solves the final-line requirements

I have no idea if it can be done shorter (in Python 2).
by Sp3000, 61 bytes :
print',\n'.join("'%02d:%s0'"%(h/2,h%2*3)for h in range(48))

How about: print',\n'.join("'%02d:%s0'"%(h/2,h%2*3)for h in range(48))

Brilliant, Sp3000! (you should post it)

Nah, not different enough to post in my book. All I did was drop the square brackets (which are unnecessary even in your one) and drop m. (Also it's 59 bytes, not 61)

golflua 52 51 chars
~@n=0,47w(S.q("'%02d:%d0'%c",n/2,n%2*3,n<47&44|0))$

Using ascii 44 = , and 0 a space saves a character.
An ungolfed Lua version would be
for h=0,47 do
   print(string.format("'%02d:%d0'%c",h/2,h%2*3, if h<47 and 44 or 0))
end

The if statement is much like the ternary operator a > b ? 44 : 0.

Julia: 65 64 61 characters
[@printf("'%02d:%d0'%s
",i/2.01,i%2*3,i<47?",":"")for i=0:47]

Julia: 64 characters
(Kept here to show Julia's nice for syntax.)
print(join([@sprintf("'%02d:%d0'",h,m*3)for m=0:1,h=0:23],",
"))

Python, 60 58 64 bytes
for i in range(24):print("'%02d:00,\n%02d:30'"%(i,i)+', '[i>22])

Ungolfed:
for i in range(24):
    if i <23:
        print( ('0'+str(i))[-2:] + ':00,\n' + str(i) + ':30,')
    else:
        print( ('0'+str(i))[-2:] + ':00,\n' + str(i) + ':30')

Try it online here.

Why not put it on 1 line, and save another 2 bytes.

I don't think this works - no leading zero on the hour.

@isaacg fixed that!

The output is not the same as in the original question.

@sentiao what is different?

you can save a couple of bytes by mixing single and double quotes instead of escaping your quotes '\'%02d:00,\n%02d:30\'' could be "'%02d:00,\n%02d:30'" saving 2 bytes for the slashes

Haskell, 85 bytes
putStr$init$init$unlines$take 48['\'':w:x:':':y:"0',"|w<-"012",x<-['0'..'9'],y<-"03"]

Unfortunately printf requires a 19 byte import, so I cannot use it.

JavaScript (ES6), 77 86+1 bytes
Didn't realize there had to be quotes on each line (+1 is for -p flag with node):
"'"+Array.from(Array(48),(d,i)=>(i>19?"":"0")+~~(i/2)+":"+3*(i&1)+0).join("',\n'")+"'"

old solution:
Array.from(Array(48),(d,i)=>~~(i/2).toFixed(2)+":"+3*(i&1)+"0").join(",\n")

ungolfed version (using a for loop instead of Array.from):
var a = [];
// there are 48 different times (00:00 to 23:30)
for (var i = 0; i < 48; i++) {
    a[i] =
        (i > 19 ? "" : "0") +
            // just a ternary to decide whether to pad
            // with a zero (19/2 is 9.5, so it's the last padded number)
        ~~(i/2) +
            // we want 0 to 24, not 0 to 48
        ":" +  // they all then have a colon
        3*(i&1) +
            // if i is odd, it should print 30; otherwise, print 0
        "0" // followed by the last 0
}
console.log(a.join(",\n"));

72: Array.from(Array(48),(d,i)=>\'${i>19?"":0}${0|i/2}:${i%2*3}0'`).join`,\n``. Replace \n with an actual newline.

Fortran 96
do i=0,46;print'(a1,i2.2,a,i2.2,a2)',"'",i/2,":",mod(i,2)*30,"',";enddo;print'(a)',"'23:30'";end

Standard abuse of types & requirement only for the final end for compiling. Sadly, due to implicit formatting, the '(a)' in the final print statement is required. Still, better than the C and C++ answers ;)

C# - 120 bytes
class P{static void Main(){for(var i=0;i<24;i++)System.Console.Write("'{0:00}:00',\n'{0:00}:30'{1}\n",i,i==23?"":",");}}

, 39 chars / 67 bytes (non-competing)
↺;Ḁ⧺<Ḱ;)ᵖ`'⦃Ḁ<Ḕ?0:⬯}⦃0|Ḁ/2}:⦃Ḁ%2*3}0',”

Try it here (Firefox only).
Not a single alphabetical character in sight...

PHP, 69 70 62 bytes
for($x=-1;++$x<47;)printf("'%02d:%d0',
",$x/2,$x%2*3)?>'23:30'

Try it online
Outputting '23:30' at the end is a bit lame, and so is closing the php context using ?> without opening or re-opening it. An cleaner alternative (but 65 bytes) would be:
for($x=-1;++$x<48;)printf("%s'%02d:%d0'",$x?",
":'',$x/2,$x%2*3);

Try it online
Thank you @Dennis for the tips. Alternative inspired by the contribution of @ismael-miguel.

Welcome to Programming Puzzles & Code Golf! Your code prints a null byte at the end. I'm not sure if that is allowed.

@Dennis Thank you, you're right... I assumed PHP would see it as end-of-string. Posted a new version.

<?...?>'23:30' saves three bytes. Also, you can replace \n with an actual newline.

Python 2, 74 65 bytes
We generate a 2 line string for each hour, using text formatting:
print',\n'.join("'%02u:00',\n'%02u:30'"%(h,h)for h in range(24))

This code is fairly clear, but the clever indexing and integer maths in the answer by Sp3000 gives a shorter solution.

no reason to use formatting for 00 and 30, save 9 bytes with "'%02u:00',\n'%02u:30'"%(h,h)

you could save some bytes by having too loops :    print',\n'.join("'%02u:%02u'"%(h,i)for h in range(24)for i in[0,30])

Thanks DenDenDo. I used this to save some bytes. Dieter, I can see where your idea may help, but I could save more bytes with that idea from DenDenDo.

Javascript, 89 bytes
for(i=a=[];i<24;)a.push((x="'"+("0"+i++).slice(-2))+":00'",x+":30'");alert(a.join(",\n"))

Quick question: how many arguments Array.push() supports? ;)

You're right. That is a polyad. Thanks, I'll make that change after I finish testing my entry for another challenge.

A few more characters can be removed with some elementary reorganizations: for(i=a=[];i<24;)a.push((x=("0"+i++).slice(-2))+":00",x+":30");alert(a.join(",\n"))

There, I fixed it.

That reuse of variable x is quite ugly coding habit. If you change the loop control variable to something else (as in my suggestion at 2015-05-07 15:28:25Z), then you can add the opening single quotes to x's value to reduce the two "'"+ pieces to one: for(i=a=[];i<24;)a.push((x="'"+("0"+i++).slice(-2))+":00'",x+":30'");alert(a.join(",\n"))

That one's giving me a syntax error for some reason:  "Invalid character '\u8203'"

No idea what kind of crappy character keeps infiltrating in that text. If you type in the alert()'s parameter by hand, the rest of code should be fine.

@manatwork Just asked google, unicode 8203 is a zero-width space, apparently.

Python 2: 64 bytes
print ',\n'.join(['%02d:00,\n%02d:30'%(h,h) for h in range(24)])

The output is not the same as in the original question.

I don't know what happened to the edit I made.  here is the correct version also 64 chars: print',\n'.join("'%02d:00',\n'%02d:30'"%(h,h)for h in range(24))

Ruby - 52 bytes
puts (0..47).map{|i|"'%02d:%02d'"%[i/2,i%2*30]}*",
"

This seems like my solution with just the change of the .join for *... It's common courtesy to instead of just posting a new answer with a minor improvement, to suggest the improvement to the original poster. See http://meta.codegolf.stackexchange.com/questions/75/what-should-the-policy-on-improving-or-incorperating-other-peoples-solutions-be

@rcrmn I agree I made a mistake and I apologize for it - should've had looked for other ruby answers first. Great work though in your answer with $><<!

Don't worry about it, you are new here: I was advising you so that you could avoid this in the future.

PHP 89 88 87 85 bytes
<?for($i=0;$i<24;$i++){$a=sprintf("%02d",$i);echo"'$a:00',\n'$a:30'",$i<23?",\n":'';}

I tried but it isn't the shortest in PHP.
Old code:
<?for($i=0;$i<24;$i++){($i<10?$a="0$i":$a=$i);echo"'$a:00',\n'$a:30'".($i==23?'':",\n");}

Why the parenthesis around the whole first ternary expression? And reverse the last ternary to use the shorter < operator instead of ==: $i<23?",\n":''.

@manatwork So it adds the 0 in front of every number lower than 10, without the parenthesis it wouldn't work. With the < it would add a comma at the end

Works for me. But anyway, you are using the ternary in a strange way. Usually the assignment is done outside. And that expression could also be rewritten to compare against 9 instead of 10, sparing another 1 character: <?php for($i=0;$i<24;$i++){$a=$i>9?$i:"0$i";echo"'$a:00',\n'$a:30'".($i<23?",\n":'');}

Ah yes, I had it the other way around. Thank you.

One more thing: the parenthesis around the last (now only) ternary is required just because you concatenate it to the other piece of string. As echo supports multiple parameters, just enumerate them separated with comma and you can spare the parentheses.

PowerShell, 69 Bytes
$d=date 0;(0..47|%{"'{0:HH:mm}'"-f$d;$d=$d.AddMinutes(30)})-join",`n"

I love how it's shorter to use actual date functions than simply try to brute force the numbers with .ToString operators to pad zeroes and logic to decide if we're in a 00 or a 30 output.
Sets a new date $d to be 00:00:00 Jan 1 0000, then goes into a loop 48 times with 0..47|%{..}. Each time in the loop we generate our output using the -f operator. The HH:mm format for dates gives us 24-hour time with minutes, just as we want. Then, we addMinutes(30) to prep us for the next go-round. Outside the loop, we -join everything together with a comma and a newline.

TreeHugger, 1433 Bytes
TreeHugger is a bf variant that uses a binary tree instead of a linear tape. Read about it here and you can run scripts on the implementation here. As for how this program works, here is a rough run down:

Store the characters needed

In the first loop, get within 5 of the desired value
Manually adjust to the correct value

Walk through the tree and print the proper characters in the proper order

WARNING: This step is a little tedious

++++++++++[>++++++>+++++>+++++>++++>++++>+^^^^^<+++++>+++++^^^<++++>+++++>+++++^<+++++^^<+++++>+++++>++++++^<++++++^^<+++++>++++++^<+++++^^^^-]>-->+>-->->++++>^^^^^<+++>++^^^<->->+++^<++^^<-->+>---^<----^^<>-----^<++++^^^^<.<..^^>.>>.[.>]^^^^^^^^<.<..^^>[.>]^^^^^^^^<.<.^>.^^>.>>.[.>]^^^^^^^^<.<.^>.^^>[.>]^^^^^^^^<.<.<.^^^>.>>.[.>]^^^^^^^^<.<.<.^^^>[.>]^^^^^^^^<.<.>.^^^>.>>.[.>]^^^^^^^^<.<.>.^^^>[.>]^^^^^^^^<.<.^><.^^^>.>>.[.>]^^^^^^^^<.<.^><.^^^>[.>]^^^^^^^^<.<.^>>.^^^>.>>.[.>]^^^^^^^^<.<.^>>.^^^>[.>]^^^^^^^^<.<.<<.^^^^>.>>.[.>]^^^^^^^^<.<.<<.^^^^>[.>]^^^^^^^^<.<.<>.^^^^>.>>.[.>]^^^^^^^^<.<.<>.^^^^>[.>]^^^^^^^^<.<.><.^^^^>.>>.[.>]^^^^^^^^<.<.><.^^^^>[.>]^^^^^^^^<.<.>>.^^^^>.>>.[.>]^^^^^^^^<.<.>>.^^^^>[.>]^^^^^^^^<.>.^<.^^>.>>.[.>]^^^^^^^^<.>.^<.^^>[.>]^^^^^^^^<.>..^^>.>>.[.>]^^^^^^^^<.>..^^>[.>]^^^^^^^^<.>.^<<.^^^>.>>.[.>]^^^^^^^^<.>.^<<.^^^>[.>]^^^^^^^^<.>.^<>.^^^>.>>.[.>]^^^^^^^^<.>.^<>.^^^>[.>]^^^^^^^^<.>.<.^^^>.>>.[.>]^^^^^^^^<.>.<.^^^>[.>]^^^^^^^^<.>.>.^^^>.>>.[.>]^^^^^^^^<.>.>.^^^>[.>]^^^^^^^^<.>.^<<<.^^^^>.>>.[.>]^^^^^^^^<.>.^<<<.^^^^>[.>]^^^^^^^^<.>.^<<>.^^^^>.>>.[.>]^^^^^^^^<.>.^<<>.^^^^>[.>]^^^^^^^^<.>.^<><.^^^^>.>>.[.>]^^^^^^^^<.>.^<><.^^^^>[.>]^^^^^^^^<.>.^<>>.^^^^>.>>.[.>]^^^^^^^^<.>.^<>>.^^^^>[.>]^^^^^^^^<.<<.^.^^>.>>.[.>]^^^^^^^^<.<<.^.^^>[.>]^^^^^^^^<.<<.^^>.^^>.>>.[.>]^^^^^^^^<.<<.^^>.^^>[.>]^^^^^^^^<.<<..^^^>.>>.[.>]^^^^^^^^<.<<..^^^>[.>]^^^^^^^^<.<<.^>.^^^>.>>.[.>]^^^^^^^^<.<<.^>.^^^>.>.>.>.

Un-Golfed
The three digit numbers are the ASCII values we're aiming for in the approximation and adjustment phases. The numbers in the print phase, indicate the hour that we are printing.
# Approximation
+++++ +++++ [
058 > +++++ +
051 > +++++
048 > +++++
039 > ++++
044 > ++++
010 > +
^^^^^
053 < +++++
052 > +++++
^^^
039 < ++++
049 > +++++
053 > +++++
^
052 < +++++
^^
048 < +++++
051 > +++++
057 > +++++ +
^
056 < +++++ +
^^
050 < +++++
055 > +++++ +
^
054 < +++++
^^^^ -
]
# Adjustment
058 > --
051 > +
048 > --
039 > -
044 > ++++
010 >
^^^^^
053 < +++
052 > ++
^^^
039 < -
049 > -
053 > +++
^
052 < ++
^^
048 < --
051 > +
057 > ---
^
056 < ----
^^
050 <
055 > -----
^
054 < ++++
^^^^
# Print
0
<.<..^^     >.>>.[.>] ^^^^^ ^^^
<.<..^^     >[.>] ^^^^^ ^^^
1
<.<.^>.^^   >.>>.[.>] ^^^^^ ^^^
<.<.^>.^^   >[.>] ^^^^^ ^^^
2
<.<.<.^^^   >.>>.[.>] ^^^^^ ^^^
<.<.<.^^^   >[.>] ^^^^^ ^^^
3
<.<.>.^^^   >.>>.[.>] ^^^^^ ^^^
<.<.>.^^^   >[.>] ^^^^^ ^^^
4
<.<.^><.^^^ >.>>.[.>] ^^^^^ ^^^
<.<.^><.^^^ >[.>] ^^^^^ ^^^
5
<.<.^>>.^^^ >.>>.[.>] ^^^^^ ^^^
<.<.^>>.^^^ >[.>] ^^^^^ ^^^
6
<.<.<<.^^^^ >.>>.[.>] ^^^^^ ^^^
<.<.<<.^^^^ >[.>] ^^^^^ ^^^
7
<.<.<>.^^^^ >.>>.[.>] ^^^^^ ^^^
<.<.<>.^^^^ >[.>] ^^^^^ ^^^
8
<.<.><.^^^^ >.>>.[.>] ^^^^^ ^^^
<.<.><.^^^^ >[.>] ^^^^^ ^^^
9
<.<.>>.^^^^ >.>>.[.>] ^^^^^ ^^^
<.<.>>.^^^^ >[.>] ^^^^^ ^^^
10
<.>.^<.^^   >.>>.[.>] ^^^^^ ^^^
<.>.^<.^^   >[.>] ^^^^^ ^^^
11
<.>..^^     >.>>.[.>] ^^^^^ ^^^
<.>..^^     >[.>] ^^^^^ ^^^
12
<.>.^<<.^^^ >.>>.[.>] ^^^^^ ^^^
<.>.^<<.^^^ >[.>] ^^^^^ ^^^
13
<.>.^<>.^^^ >.>>.[.>] ^^^^^ ^^^
<.>.^<>.^^^ >[.>] ^^^^^ ^^^
14
<.>.<.^^^   >.>>.[.>] ^^^^^ ^^^
<.>.<.^^^   >[.>] ^^^^^ ^^^
15
<.>.>.^^^   >.>>.[.>] ^^^^^ ^^^
<.>.>.^^^   >[.>] ^^^^^ ^^^
16
<.>.^<<<.^^^^ >.>>.[.>] ^^^^^ ^^^
<.>.^<<<.^^^^ >[.>] ^^^^^ ^^^
17
<.>.^<<>.^^^^ >.>>.[.>] ^^^^^ ^^^
<.>.^<<>.^^^^ >[.>] ^^^^^ ^^^
18
<.>.^<><.^^^^ >.>>.[.>] ^^^^^ ^^^
<.>.^<><.^^^^ >[.>] ^^^^^ ^^^
19
<.>.^<>>.^^^^ >.>>.[.>] ^^^^^ ^^^
<.>.^<>>.^^^^ >[.>] ^^^^^ ^^^
20
<.<<.^.^^      >.>>.[.>] ^^^^^ ^^^
<.<<.^.^^      >[.>] ^^^^^ ^^^
21
<.<<.^^>.^^  >.>>.[.>] ^^^^^ ^^^
<.<<.^^>.^^  >[.>] ^^^^^ ^^^
22
<.<<..^^^    >.>>.[.>] ^^^^^ ^^^
<.<<..^^^    >[.>] ^^^^^ ^^^
23
<.<<.^>.^^^    >.>>.[.>] ^^^^^ ^^^
<.<<.^>.^^^    >.>.>.>.

This can be golfed down more, I have a 1198 byte version that should work, but I think this implementation might have a bug. So stay tuned until I finish debugging my own implementation.

Java, 93 bytes
void t(){for(int i=0;i<24;)System.out.printf("'%02d:00',\n'%02d:30'%s",i,i,i++<23?",\n":"");}

Ungolfed
void t()
{
    for(int i = 0; i < 24; i++)
    {
        System.out.printf("'%02d:00',\n", i);
        System.out.printf(   "'%02d:30'", i);
        System.out.printf( i < 23 ?",\n":"");
    }
}

JavaScript, 127 bytes
I'm not a very good golfer :s
var r='',i,m=":00',\n",q="'"
for(i=0;i<23;i++){
h=("0"+i).slice(-2)
r+=q+h+m+q+h+":30',\n"
}
r+=q+i+m+q+i+":30'"
console.log(r)

Java, 179 bytes
public class M{public static void main(String[] a){String r="",f="'%02d:%s',\n";for(int i=0;i<24;i++)r+=String.format(f+f,i,"00",i,"30");System.out.print(r.replaceAll(".$",""));}}

ungolfed
public class M {
    public static void main(final String[] a) {
        String r = "", f = "'%02d:%s',\n";
        for (int i = 0; i < 24; i++)r += String.format(f + f, i, "00", i, "30");
        System.out.print(r.replaceAll(".$", ""));
    }
}

don't be that modest! :)

I'm not super good with javascript but I made a couple of improvements to bring it down to 104 bytes :) I removed some whitespace and moved the 23:** hour into the loop. This means you don't need the r+=q+i+m+q+i+":30'" line, but there is an extra comma, so you have to cut it off when you print it. That lets you save a lot of bytes, both from the removed line and variable initialization. You also might want to look into making this a 0-arg function, so you can use ES6 function syntax. There's a bit of boilerplate code you have to add, but usually returning > printing.

C++ - 104 bytes
I spend a while trying to find an obtuse way to remove the comma, but in the end the simple approach seemed to be by far the most efficient.
#include<cstdio>
int main(int c,char**v){for(c=-1;c++<47;printf("'%.2d:%d0'%s\n",c/2,c%2*3,c>46?"":","));}

I shouldn't need to initialize c to -1 but I couldn't get an inline postfix increment to work how I expected.

You can reduce one byte by #include<cstdio>. Also, one byte can go from the c=-1 by changing it to c=0 and moving the increment inside the printf like for(c=0;48>c;printf("'%.2d:%d0'%s\n",c/2,c%2*3,c++>46?"":","));. Note that with this, the actual output may depend on the compiler, the processor, etc, because of the unsequenced modification of c, and the compiler will give a warning accordingly.

@rcrmn Thanks! Unfortunately, that for loop is what I had initially, but it doesn't behave as I would expect on MSVC++.  Your code gives me 00:30 to 24:00, which indicates right-to-left argument evaluation, but if I move the ++ into c/2 I get the 00s and 30s swapped, which would indicate left-to-right evaluation.  My guess is the compiler is attempting to optimize by doing c++/2 first and using the result to calculate c%2.

Oh I see. Using Apple LLVM version 6.0 (clang-600.0.57) here. I thought I was using gnu g++, but it seems apple likes to hide these things to the user.

82 bytes

JavaScript (ES6), 81 77 bytes
Template strings work well for cutting down the size.
alert([...Array(48)].map((x,i)=>`'${i<20?0:''}${i/2|0}:${i%2*3}0'`).join`,
`)

Usually we call such code ECMAScript to emphasize the presence of experimental features. By the way, your code generates no output. (In JavaScript Standards for IO meta discussion we concluded that JavaScript should also use explicit output methods when output is requested.)

@manatwork Thanks for that link! I figured there would be something like that, but couldn't find anything, and having seen other examples elsewhere on the site without explicit prints, I just went with it. I'll update the answer. Good to know on the ECMAScript detail as well! =)

I don't think this works: http://www.es6fiddle.net/i9essmvf/

@royhowie For some reason, es6fiddle requires variables be declared with var (add it before the i=0 and you'll see it works). While usually a good idea to have, it is not required.

It certainly works as is in Firefox. And 1 more character can be spared thanks to the template strings: instead of \n in join()'s parameter, make that string also a template string and include a literal newline.

PHP, 82 77 bytes
Nothing fancy, just abusing PHP's string capacities.
<?for($H=-1;$H++<23;)echo$H?",
'":"'",$H=str_pad($H,2,0,0),":00',
'$H:30'";

Probably there's something that I can cut off.
Old version, 82 bytes:
<?foreach(range(0,23)as$H)echo$H?",
'":"'",$H=str_pad($H,2,0,0),":00',
'$H:30'";

C# - lots (but give away free with windows)
using System;
using System.Collections.Generic;
using System.Linq;
class P
{
    static void Main()
    {
        Console.Write(String.Join(",\n", Enumerable.Range(0, 48).Select(i => "'" + i / 2 + ":" + (i % 2) * 3 + "0'")));
    }
}

PostgreSQL: 97 characters
select string_agg(to_char(x*interval'30m','''hh24:mi'''),','||chr(10))from generate_series(0,47)x

PostgreSQL: 132 131 116 characters
Kept here to show PostgreSQL's cool way to generate timestamp series.
select string_agg(to_char(x,'''hh24:mi'''),','||chr(10))from generate_series('150511','150511 23:59',interval'.5h')x

Python, 145 bytes
import time as t;i=48;a=t.asctime;w=3600;s=t.sleep;s(24-int(a()[11:13])*w+w-60*int(a()[14:16]));
while i:print '\''+a()[11:16]+'\',';i-=1;s(w)

I guess the code is fairly readable (altough quite long). Once you run the program it waits until actual local time is 00:00h, then prints the time and waits for 30 min, time in which the program prints the hour again. It keeps repeating this process until 00:00h of the next day is reached. Therefore, with lots of patience and no incidents that force your computer to shutdown all the times get printed.

Ceylon, 101 bytes
shared void run(){print(",\n".join{for(h in 0..23)for(m in[0,3])"'``"``h``".pad(2,'0')``:``m``0'"});}

Formatted:
shared void run() {
    // original:
    print(",\n".join {
            for (h in 0..23)
                for (m in [0, 3])
                    "'``"``h``".pad(2, '0')``:``m``0'"
        });
}

This uses an iterable comprehension with two for-clauses, and nested string templates. "``h``" is a shorter way of writing h.string (we can't pad an integer directly).
",\n".join(iterable) puts the commas and new-lines between the strings (this way we can avoid the , in the last line).
Unfortunately Ceylon has no printf functionality, which would certainly make things shorter (no .pad or .string necessary).
After finding that "straightforward" solution, I experimented with some variations, which unfortunately result in slightly longer shrinked solutions:
shared void run() {
    print(",\n".join(
            (0..23)
                *.string
                *.pad(2, '0')
                .map((x) => "'``x``:00',\n'``x``:30'")
        ));
}

(102 bytes)
shared void run() {
    print(",\n".join {
            for (h in 0..23)
                let (x = "``h``".pad(2, '0'))
                    "'``x``:00',\n'``x``:30'"
        });
}

(104 bytes)
shared void run() {
    print(",\n".join(
            (0..23)
                .map((i) => "``i``".pad(2, '0'))
                .map((x) => "'``x``:00',\n'``x``:30'")));
}

(111 bytes)

Burlesque, 30 bytes
Burlesque is sadly rather weak when it comes to formatting because it doesn't have a printf (yet).
23rzm{2'0lp}":00 :30"wdcp)\[uN

Details see here.

Pyth, 24 bytes
V24V2%"'%02d:%d0',",N*3H

Run code
V24                     for loop 0-23, N counter
  V2                    for loop 0-1, H counter
    %                   format string
      "'%02d:%d0',"     source string
      ,                 begin list tuple
        N               first element, hour
        *3H             second element, minutes

Every second iteration of the second for loop, H is 1, which toggles the minutes digit between 0 and 3.
Interpreted code generated by the debugger:
for N in num_to_range(24):
 for H in num_to_range(2):
  imp_print(mod("'%02d:%d0',",[N,times(3,H)]))

PHP, 104 96 bytes
for($h=$m=0;$h<24;){echo($h||$m?",\n":"")."'".($h<10?0:"")."$h:".($m*3)."0'";if($m)$h++;$m=!$m;}

exploded view
for ($h = $m = 0; $h < 24; ) {
  echo ($h || $m ? ",\n" : "") . "'" . // echoes ",\n" on all but the first loop
       ($h < 10 ? 0 : "") . "$h:" .    // leading 0 for 0:00 - 9:30
       ($m * 3) . "0'";                // :00 if $m=0, :30 if $m=1
  if ($m) $h++;                        // increments $h if :30
  $m = !$m;                            // swaps :00 <-> :30
}

Java 7, 88 bytes
void c(){for(int i=0;i<48;)System.out.printf("'%02d:%s0'%s",i/2,i%2*3,i++<47?",\n":"");}

Shorter than the other three Java answers: 93 bytes & 94 bytes & 119 bytes
Explanation:
void c(){                  // Method
  for(int i=0;i<48;)       //  Loop from 0 to 48 (exclusive)
    System.out.printf(     //   Print with format:
      "'%02d:%s0'%s",      //    "'##:#0'X" (where `#` is a digit, and `X` is a String)
      i/2,                 //    (%02d) Current index divided by 2 and automatically floored
      i%2 * 3              //    (%s0) i%2 is either 0 or 1 (multiplied by 3 is either 0 or 3)
      i++<47 ? ",\n" : ""  //    (%s) A comma and new-line, unless it's the final line
                           //  End of loop
}                          // End of method

Try it here.

AHK, 96 bytes
t=20000101000000
Loop,48{
FormatTime,i,%t%,HH:mm
Send,'%i%',`n
EnvAdd,t,30,Minutes
}
Send,{BS 2}

AHK does not play nicely with time values so I have to store two variables: one to track the time in the format YYYYMMDDHH24MISS and another just to store the pretty text in the format HH:MI.


text:
Identify halves of Poker cards
A casino uses the following deck of cards. (* is one of the card suits D, S, C or H.)
 _________    _________    _________    _________    _________
|         |  |         |  |         |  |         |  |         |
|         |  |         |  |    *    |  |  *   *  |  |  *   *  |
|         |  |    *    |  |         |  |         |  |         |
|    *    |  |         |  |    *    |  |         |  |    *    |
|         |  |    *    |  |         |  |         |  |         |
|         |  |         |  |    *    |  |  *   *  |  |  *   *  |
|_________|  |_________|  |_________|  |_________|  |_________|

 _________    _________    _________    _________    _________
|         |  |         |  |         |  |         |  |         |
|  *   *  |  |  *   *  |  |  *   *  |  |  *   *  |  |  *   *  |
|         |  |         |  |  *   *  |  |  *   *  |  |  *   *  |
|  *   *  |  |  * * *  |  |         |  |    *    |  |  *   *  |
|         |  |         |  |  *   *  |  |  *   *  |  |  *   *  |
|  *   *  |  |  *   *  |  |  *   *  |  |  *   *  |  |  *   *  |
|_________|  |_________|  |_________|  |_________|  |_________|

 _________    _________    _________
|         |  |         |  |         |
|  *   *  |  |  *   *  |  |  * * *  |
|  *   *  |  |  * * *  |  |  *   *  |
|  * * *  |  |  *   *  |  |  * * *  |
|  *   *  |  |  * * *  |  |  *   *  |
|  *   *  |  |  *   *  |  |  * * *  |
|_________|  |_________|  |_________|

After each night, old decks are discarded, and cut in half to avoid reuse.
As a result, the casino has a big room full of cut card halves.
Unfortunately the economy is bad, and the casino is in financial trouble. The most
reasonable thing to save money seems to be recycling, so the casino owners decide to tape old cards back together. So they hire a team to build a machine which will do this.
You are part of the team, and your job is to help identifying the card.
Write a program or function which will take an ASCII art image of a card half in the form of a string, and will return a string of what card it is.
Input is an 11x5 string, plus line break characters (CR, LF or CRLF, you only need to support one). You may assume trailing whitespace at the end of each input line, if necessary. The input won't contain any invalid characters (any other than _|-HSCD and space and line break).
A card half will look like this:
 _________
|         |
|  H   H  |
|  H H H  |
---H---H---

which should be identified as the Queen of Hearts:
H12

The casino is on a limited budget, so this is code golf: the shortest program wins.

@Optimizer Well, we all know casinos are poor underdogs of society :) I added some clarification on input.

what methods of input are acceptable?

@tfitzger Any kind of string or character array that represents the card. I don't want to put too strict restrictions on that, as it's not "the meat" of the puzzle.

Thanks. Also, what about inputs that don't match a card above. For example, _________\n|         |\n|  H   H  |\n|  H H H  |\n-------H---.

@tfitzger You can ignore any invalid/impossible cards. We assume that there are only valid cards. So you need to only take previously mentioned 13 layouts in to consideration.

Can the output have a space between the two? Like H 12?

What does budget have to do with the number of lines of code? :)

@DA. Maybe the programmers are paid by the line/byte...

@DA we forgot to mention they casino managers are stuck with 1980's business practices.

CJam, 16 15 13 12 bytes
q2*A~<$e`3=(

Test it here.
Explanation
The basic idea is to manipulate the string such that we can make CJam's built-in run-length encoding work for us.
Let's go through an example (the one from the question). The input string is
 _________
|         |
|  H   H  |
|  H H H  |
---H---H---

We repeat that twice:
 _________
|         |
|  H   H  |
|  H H H  |
---H---H---
 _________
|         |
|  H   H  |
|  H H H  |
---H---H---

And remove the last line:
 _________
|         |
|  H   H  |
|  H H H  |
---H---H---
 _________
|         |
|  H   H  |
|  H H H  |

Then we sort this string. It'll now have a bunch of newlines at the start, and then this (shortened by a few spaces to avoid a horizontal scrollbar):
                                    ---------HHHHHHHHHHHH__________________||||||||||||

While the suit character will vary, it'll always be an upper case letter, found in the fourth run of the sorted string (accounting for the newline). When we run-length encode this we get
[8 '\n] [46 ' ] [9 '-] [12 'H] [18 '_] [12 '|]]

So all we need to do is pick out the fourth  element and reverse it.
Here is a breakdown of the actual code:
q              e# Read the input.
 2*            e# Repeat twice.
   A~<         e# Remove the last 11 characters, i.e. the last line.
      $        e# Flatten into a single string and sort its characters.
       e`      e# Run-length encode: turns the sorted string into 5 pairs of numbers
               e# and characters.
         3=    e# Select the one corresponding to the suit.
           (   e# Pull off the number so that its printed after the suit.

Pyth (recent version), 16 bytes
p/KsP*2.zJ@S{K2J

Try it online: Pyth Compiler/Executor
Explanation:
       .z           read all lines from input
     *2             duplicate all lines
    P               remove the last line
   s                combine all lines to a big string
  K                 store in K

            {K      set(K), removes duplicate chars
           S        sort, this will result in the list [' ', '-', color, '_', '|']
          @   2     take the element at index 2
         J          and store it in J

p/K      J     J    print J + (count J in K)

Pyth 4.0, 13 bytes
jk@.rSsP*2.z2

Pyth had a build in run-length-encoding. But only for short time. If someone wants to try this: Clone the Pyth repo and checkout the commit 6a6dccd.
This program works pretty much the same way as Martin's CJam solution.
      sP*2.z        like in the 16 bytes solution
     S              sort
   .r               run-length-encoding
  @         2       element at index 2
jk                  join by "" and print

CJam, 22 bytes
qN/)'--\s"_| "-_]s)\,)

Looking at more golfing options here. Here is how it works:
qN/                       e# Read the entire input from STDIN and split it on new lines
   )'--                   e# Take out the last line and remove - from it
       \                  e# Stack contains the half HSDC now. We swap this with rest of
                          e# the input
        s                 e# join the rest of the input array to a single string
         "_| "-           e# Remove anything other than HSCD
               _]s        e# Copy this and convert everything on stack into a single
                          e# string. Now we have the total HSCD in the complete card
                  )       e# Take out the last of HSCD. This serves as first character of
                          e# the output
                   \,)    e# Swap and take length of rest of the HSCD. Increment it by 1
                          e# as we removed 1 in the previous step.

Try it online here

Python 2, 80 68 66 bytes
Try it here
Duplicate the input, find all the letters in all but the last line (the first couple chars in the last line cannot be letters), then print the first letter and how many.
s=(input()*2)[:-9]
for c in"CDHS":
    if c in s:print c+`s.count(c)`

Input: ' _________\n|         |\n|  H   H  |\n|  H H H  |\n---H---H---'
Output: H12
Previous version that uses regex (68):
import re
r=re.findall('[C-S]',(input()*2)[:-9])
print r[0]+`len(r)`

Thanks to Sp3000 for golf help.

@Sp3000 This is as short as I could get it using that method. It's 15 longer. i=input()*2;s="CDSH";r=[i[:-9].count(x)for x in s];n=sum(r);print s[r.index(n)]+`n`

Ah, I couldn't figure out how to get the suit better.

J, 26 bytes
(],[:":@(+/)]=[,_9}.[)4{~.

Usage:
   ((],[:":@(+/)]=[,_9}.[)4{~.) input
H12

Reading the code from left to right:

We get the suit from the input as the 5th distinct character in it (4{~.).
Count (+/) the number that character occurs total in the input ([) and the input without the last 9 characters (_9}.[).
Finally we concatenate the suit (]) to the resulting sum's string representation (":) .

APL, 39 bytes
I'm sure this could be made much shorter, but it's a start.
f←{X←(∊⍵[⍳46]⍵)∩'HDCS'⋄((⊃X),0⍕⍴X)~' '}

This creates a named monadic function that accepts an input string and returns a string containing the card's suit and value. You can try it online!
Explanation:
f ← {                         ⍝ Define the function f.
     X←                       ⍝ Assign X as
       (∊⍵[⍳46]⍵)             ⍝ the right input duplicated, no center line
                 ∩ 'HDCS'     ⍝ intersect 'HDCS'.
                              ⍝ X is now a vector like 'HHHHHH'.
     ((⊃X)                    ⍝ Return the first element of X
          ,                   ⍝ concatenated with
           0⍕⍴X)              ⍝ the length of X as a string
                ~' '          ⍝ without a space.
}

Suggestions are welcome as always!

How about (⊃,≢)'HDCS'∩⍨¯11↓,⍨?

Shorter, but more bytes: 5⌷{⍺,≢⍵}⌸¯11↓,⍨⍞

Perl, 75 bytes
@r=();foreach ((<>)[2,2,3,3,4]){push@r,$1 while(/([CDSH])/g)}print $r[0].@r

Ungolfed version
@r=(); # Collect matches in this array
foreach ((<>)               # Read stdin as a single array of lines
                            # Note that for a subroutine use @_ for (<>)
         [2,2,3,3,4]) {     # Look at the 3rd, 4th rows twice, 5th row once
    push @r, $1             # Collect individual character matches
        while (/([CDSH])/g) # As long as one of the suits matches
}
print $r[0]                 # Each element of array is matching letter
      .@r                   # Array reference in scalar context gives length

Bash + coreutils, 73
sed '$q;s/.*/&&/'|fold -1|sort|uniq -c|sed -nr 's/ +(\w+) ([C-S])/\2\1/p'

Julia, 58 bytes
s->(m=matchall(r"[A-Z]",s*s[1:46]);join([m[1],length(m)]))

This creates an unnamed function that takes a string as input and returns the card's suit and value. To call it, give it a name, e.g. f=s->(...).
Ungolfed + explanation:
function f(s)
    # Find all alphabetic characters in the input joined with itself
    # excluding the second center line, which begins at the 47th
    # character

    m = matchall(r"[A-Z]", s * s[1:46])

    # Take the first match and the number of matches as an array,
    # collapse the array into a string, and return it

    join([m[1], length(m)])
end

Suggestions are welcome as always!


text:
Twelve-coin problem
Background
The twelve-coin problem is a classic balance puzzle commonly used in job interviews. The puzzle first appeared in 1945 and was posed to my father by my grandfather when he asked to marry my mother! In the puzzle there are twelve coins, one of which is either heavier or lighter than the others (you don't know which). The problem is to use a balance scales three times to determine the unique coin. In some variations, it is also necessary to identify whether the coin is heavier or lighter.
The task here involves solving the general problem involving n coins, using the fewest weighings possible in the worst case. It is not necessary to identify whether the coin is heavier or lighter, only which one it is. Furthermore, you do not have access to any additional coins outside the given set (which, curiously, makes a difference).
It turns out that k weighings are sufficient for up to (3^k-1)/2 coins (so 4 weighings in this variation can actually handle 13 coins). Furthermore (and surprisingly), it is possible (but not required here) to select the full set of weighings in advance, rather than have future weighings depend on past results. For descriptions of two possible solutions, see this paper and this Quora answer.
Task
Write a function or program, taking an integer n as input via STDIN, command-line argument or function argument, which solves the problem for n coins using the fewest weighings possible in the worst case. The program should:

Print weighings to STDOUT in the format 1,2,3-4,5,6 to indicate the lists of coins on each side of the scale. Any coins not being weighed should not be mentioned. The coins are implicitly numbered from 1 to n and need not be printed in numeric order (so 2,1-3,4 is the same as to 1,2-3,4).
After each weighing the program should wait on an input via STDIN, which should be <, = or >, indicating whether the left side of the scale is lighter, the same, or heavier than the right side.
After the last weighing result, the program should print or return the number of the unique coin.
The program need not handle inconsistent result inputs from the user.
The program need not handle n less than 3.

Example outputs
>> 3
1-2
>> =
1-3
>> <
3

# using Quora algorithm
>> 13
1,2,3,4-5,6,7,8
>> <
1,2,5-3,4,6
>> >
3-4
>> <
3

# using paper algorithm
>> 13
1,2,3,4-5,6,7,8
>> <
2,6,7,9-3,8,10,11
>> >
6,8,10,12-4,5,7,11
>> =
3

Scoring
Shortest code wins. Standard rules apply.

Python 3: 497 bytes
I=lambda a,b:input(",".join(a)+"-"+",".join(b)+"\n>> ")
def A(a,b):
 l,L=len(a),len(b)
 if l+L==1:return(a or b)[0]
 m=(2*l+1-L)//3;M=m+L-l;x,y,X,Y=a[:m],a[m:2*m],b[:M],b[M:2*M];r=I(x+X,y+Y);return A(a[2*m:],b[2*M:])if r=="="else A(x,Y)if r=="<"else A(y,X)
def B(a,n=[]):
 if len(a)==1:return a[0]
 m=len(n);l=(len(a)+1+m)//3;x,y,z=a[:l],a[l:2*l-m],a[2*l-m:];r=I(x,y+n);return B(z,a[:1])if r=="="else A(x+z[:1-m],y)if r=="<"else A(y+z[:1-m],x)
print(B(list(map(str,range(1,int(input("N= "))+1)))))

I suspect this could be shrunk down a bit more, but I don't see any obvious places any more (after about 5 different versions of each function).
The code implements a slightly modified version of the algorithm from this page using three functions. The I function does the IO (printing the options and returning the user's response). The A and B functions implement the main of the algorithm. A takes two lists which differ in size by exactly one element (though either list can be the larger one): one coin in a may be lighter than normal, or one coin in b may be heavier. B does double duty. It takes one list of coins a and optionally a second list with a single coin that is known to be the correct weight. The length-rounding behavior needs to be different between the two cases, which caused no end of headaches.
The two algorithm functions can find the unusually weighted coin in k weighings given inputs of up to the following sizes:

A: 3^k total coins, divided up into two list of (3^k-1)/2 and (3^k+1)/2.
B: (3^k + 1)/2 coins if a known-good coin is supplied, (3^k - 1)/2  otherwise.

The question posed here specifies that we don't have any known-good coins at the start, so we can solve find the bad coin in a set of (3^k - 1)/2 in k weighings.
Here's a test function I wrote to make sure my code was not requesting bogus weighings or using more than the number of weighings it was supposed to:
def test(n):
    global I
    orig_I = I
    try:
        for x in range(3,n+1):
            max_count = 0
            for y in range(x*2):
                count = 0
                def I(a, b):
                    assert len(a) == len(b), "{} not the same length as {}".format(a,b)
                    nonlocal count
                    count += 1
                    if y//2 in a: return "<"if y%2 else ">"
                    if y//2 in b: return ">"if y%2 else "<"
                    return "="
                assert B(list(range(x)))==y//2, "{} {} not found in size {}".format(['heavy','light'][y%2], y//2+1, x)
                if count > max_count:
                    max_count = count
            print(x, max_count)
    finally:
        I = orig_I

This prints out the worst-case number of weighings for a given set after testing with each combination of coin and bad weight (heavy or light).
Here's the test output for sets of up to 125:
>>> test(150)
3 2
4 2
5 3
6 3
7 3
8 3
9 3
10 3
11 3
12 3
13 3
14 4
15 4
16 4
17 4
18 4
19 4
20 4
21 4
22 4
23 4
24 4
25 4
26 4
27 4
28 4
29 4
30 4
31 4
32 4
33 4
34 4
35 4
36 4
37 4
38 4
39 4
40 4
41 5
42 5
43 5
44 5
45 5
46 5
47 5
48 5
49 5
50 5
51 5
52 5
53 5
54 5
55 5
56 5
57 5
58 5
59 5
60 5
61 5
62 5
63 5
64 5
65 5
66 5
67 5
68 5
69 5
70 5
71 5
72 5
73 5
74 5
75 5
76 5
77 5
78 5
79 5
80 5
81 5
82 5
83 5
84 5
85 5
86 5
87 5
88 5
89 5
90 5
91 5
92 5
93 5
94 5
95 5
96 5
97 5
98 5
99 5
100 5
101 5
102 5
103 5
104 5
105 5
106 5
107 5
108 5
109 5
110 5
111 5
112 5
113 5
114 5
115 5
116 5
117 5
118 5
119 5
120 5
121 5
122 6
123 6
124 6
125 6

The breakpoints are exactly where you'd expect, between (3^k - 1)/2 and (3^k + 1)/2.


text:
Very Nice Friedman Numbers
A Friedman Number is a positive integer that is equal to a non-trivial expression which uses its own digits in combination with the operations +, -, *, /, ^, parentheses and concatenation.
A Nice Friedman Number is a positive integer that is equal to a non-trivial expression which uses its own digits in combination with the same operations, with the digits in their original order.
A Very Nice Friedman Number (VNFN), which I am inventing here, is a Nice Friedman Number which can be written without the less pretty (in my opinion) parts of such an expression. Parentheses, concatenation and unary negation are disallowed.
For this challenge, there are three possible ways of writing an expression without parentheses.
Prefix: This is equivalent to left-associativity. This type of expression is written with all operators to the left of the digits. Each operator applies to the following two expressions. For instance:
*+*1234 = *(+(*(1,2),3),4) = (((1*2)+3)*4) = 20

A VNFN which can be written this way is 343:
^+343 = ^(+(3,4),3) = ((3+4)^3) = 343

Postfix: This is equivalent to right-associativity. It is just like prefix notation, except that the operation go to the right of the digits. Each operator applies to the two previous expressions. For instance:
1234*+* = (1,(2,(3,4)*)+)* = (1*(2+(3*4))) = 14

A VNFN which can be written this way is 15655:
15655^+** = (1,(5,(6,(5,5)^)+)*)* = (1*(5*(6+(5^5)))) = 15655

Infix: Infix notation uses the standard order of operations for the five operations. For the purposes of the challenge, that order of operations will be defined as follows: Parenthesize ^ first, right associatively. Then, parenthesize * and / simultaneously, left associatively. Finally, parenthesize + and - simultaneously, left associatively.
1-2-3 = (1-2)-3 = -4
2/3*2 = (2/3)*2 = 4/3
2^2^3 = 2^(2^3) = 256
1^2*3+4 = (1^2)*3+4 = 7

A VNFN which can be written this way is 11664:
1*1*6^6/4 = (((1*1)*(6^6))/4) = 11664

Challenge: Given a positive integer, if it can be expressed as a non-trivial expression of its own digits in either prefix, infix or postfix notation, output that expression. If not, output nothing.
Clarifications: If multiple representations are possible, you may output any non-empty subset of them. For instance, 736 is a VNFN:
+^736 = 736
7+3^6 = 736

+^736, 7+3^6 or both would all be acceptable outputs.
A "Trivial" expression means one that does not use any operators. This only is relevant for one digit numbers, and means that one digit numbers cannot be VNFNs. This is inherited from the definition of a Friedman Number.
Answers should run in seconds or minutes on inputs under a million.
Related.
IO: Standard IO rules. Full program, function, verb or similar. STDIN, command line, function argument or similar. For outputing "Nothing", the empty string, a blank line, null or similar, and an empty collection are all fine. Output may be a string delimited with a character that cannot be in a representation, or may be a collection of strings.
Examples:
127
None

343
^+343

736
736^+
7+3^6

2502
None

15655
15655^+**

11664
1*1*6^6/4
1^1*6^6/4

5
None

Scoring: This is code golf. Fewest bytes wins.
Also, if you find one, please give a new Very Nice Friedman Number in your answer.

*(+(*(1,2),3,4) is missing one close paren, after ,3

What's the cap on "in seconds or minutes"? Four hours is still in ....many... minutes.

@NotthatCharles 4 hours is too much. Let's say 1 hour on my machine, with some wiggle room. About multi-digit numbers, that''s what I was refering to by concatenation in Parentheses, concatenation and unary negation are disallowed.

Perl, 345 334 318 293 263 245B
$_='$_=$i=pop;$c=y///c-1;sub f{say if$c&&$i==eval pop=~s/\^/**/gr}A$m)$1$4"})};f"("x$c.$m}globOx$c.$i;A$1$4($m"})};f$m.")"x$c}glob$i.Ox$c;map{f$_}glob joinO,/./g';s!O!"{+,-,*,/,^}"!g;s!A!'map{m{(\d)((?R)|(\d)(?{$m=$3}))(.)(?{$m="'!ge;s!d!D!;eval

Call with perl -M5.10.0 scratch.pl 736

Results
The first few results that I found are:
^+343
736^+
7+3^6
^+/3125
^+^3125
/^+-11664
/^--11664
1-1+6^6/4
/^++14641
^^++14641
1+5^6/1-8
1+5^6^1-8
1+5^6-2-2
1+5^6-2^2
1+5^6+2-4
1+5^6+4^2
-^+^16377
-^-+16377
/^+^16384
/^-+16384

Explanation
Fully ungolfed
I tried to repeat myself as much as possible to make the later golfing easier.
#!perl
use 5.10.0;

$_ = $input = pop;

# y///c counts characters in $_
$count = y///c - 1;

sub f {
    say if $count && $input == eval pop =~ s/\^/**/gr
}

# PREFIX
map {
    m{                            # Parses *^+1234
        (\D)                      # $1 = first symbol
        (
            (?R)                  # RECURSE
        |
            (\d)(?{               # $3 = first digit
                $match=$3
            })
        )
        (.)(?{                    # $4 = last digit
            $match="$match)$1$4"
        })
    }x;
    f "(" x $count . $match
}
    # glob expands '{0,1}{0,1}' into 00,01,10,11
    glob "{+,-,*,/,^}" x $count . $input;

# POSTFIX
map {
    m{(\d)((?R)|(\d)(?{$match=$3}))(.)(?{$match="$1$4($match"})};
    f $match. ")" x $count
}
    glob $input . "{+,-,*,/,^}" x $count;

# INFIX
# /./g splits $_ into characters
map { f $_} glob join "{+,-,*,/,^}", /./g

How it's golfed

Remove whitespace & comments and replace all vars with 1-character version
Wrap program in $_=q! ... !;eval
Extract strings and substitute them in afterwards.

This gives something like this, from which you can remove the line breaks for the result:
$_='
    $_=$i=pop;
    $c=y///c-1;
    sub f{say if$c&&$i==eval pop=~s/\^/**/gr}
    A$m)$1$4"})};f"("x$c.$m}globOx$c.$i;
    A$1$4($m"})};f$m.")"x$c}glob$i.Ox$c;
    map{f$_}glob joinO,/./g
';
s!O!"{+,-,*,/,^}"!g;
s!A!'map{m{(\d)((?R)|(\d)(?{$m=$3}))(.)(?{$m="'!ge;
s!d!D!;
eval

Thanks for the answer, and congratulations on being in first place. In broad strikes, how does it work?

I don't know perl, but it looks like it might be possible to extract the 3 occurances of }glob and save some bytes.

s!B!}glob!g;BBB -> 15B; }glob}glob}glob -> 15B :)

Darn, so close.

Ruby 2.1.5 only - 213 220 238 + 9 = 247
Not sure how Ruby beats Perl, but here you go...
Run this with a -rtimeout flag (and either -W0 or send your stderr elsewhere).
To make this slightly more robust, replace send([].methods[81],z-1) with repeated_permutation(z-1) and score an extra character (so, 248).
g=$*[0].split //
exit if 2>z=g.size
d=->a,s{$><<a*''&&exit if$*[0].to_i==timeout(2){eval"#{(s*'').gsub(?^,'**')}"}rescue p}
l,r=[?(]*z,[?)]*z
%w{* / + - ^}.send([].methods[81],z-1){|o|d[m=g.zip(o),m]
d[g+o,l.zip(m)+r]
d[o+g,l+g.zip(r,o)]}

Basically, go through all permutations of operators and try infix, postfix, and prefix in that order.  The d method uses eval on the second parameter to perform the calculations, catching any DivideByZero or Overflow exceptions.
You need to send stderr to /dev/null, though, or else eval will sometimes print warnings like (eval):1: warning: in a**b, b may be too big.
While I came up with this ungolfing, I found a way to save three chars!
Ungolfed (outdated but similar principles):
input = $*[0]
digits = input.split //
num_digits = digits.size
exit if 2 > num_digits # one-digit numbers should fail

def print_if_eval print_array, eval_array
  # concatenate the array and replace ^ with **
  eval_string = (eval_array * '').gsub(?^, '**')
  val = eval(eval_string)
  if input.to_i == val
    $><<print_array*''
    exit
  end
rescue
  # this catches any DivideByZero or Overflow errors in eval.
end
# technically, this should be * (num_digits - 1), but as long as we
# have AT LEAST (num_digits - 1) copies of the operators, this works
operators = %w{* / + - ^} * num_digits
left_parens = ['('] * num_digits
right_parens = [')'] * num_digits
operators.permutation(num_digits-1) { |op_set|
  # infix
  # just uses the native order of operations, so just zip it all together
  # 1+2-3*4/5^6
  print_if_eval(digits.zip(op_set),
                digits.zip(op_set))

  # postfix
  # leftparen-digit-operator, repeat; then add right_parens
  # (1+(2-(3*(4/(5^(6))))))
  #
  print_if_eval(digits+op_set,
                (left_parens.zip(digits, op_set) + right_parens))

  # prefix
  # leftparens; then add digit-rightparen-operator, repeat
  # ((((((1)+2)-3)*4)/5)^6)
  print_if_eval(op_set+digits,
                left_parens + digits.zip(right_parens, op_set))
}

Changelog
247 made this work for larger numbers instead of timing out.
220 shaved off three chars by declaring paren arrays, and fixed a bug where one-digit numbers were considered VNFNs
213 initial commit

Great solution - complete black magic to me! I guess ruby beats Perl since it has built-in zip and permutation functions.

@alexander-brett any better?  a.zip(b,c) returns an array of arrays like [ [a[0],b[0],c[0]],[a[1],b[1],c[1]], etc.] and ['hi', 'there']*'' just concatenates the string representation of the array values.

oh, and [a,b]*3 yields [a,b,a,b,a,b]

MATLAB (435 b)
n=input('');b=str2num(fliplr(num2str(n)));l=floor(log(b)/log(10));a=unique(nchoosek(repmat('*+-/^', 1,5), l), 'rows');for k=1:numel(a(:,1)),for j=0:2,c=strcat((j>1)*ones(l)*'(',mod(b,10)+48);for i=1:l,c=strcat(c,a(k,i),(j<1)*'(',mod(floor(b/10^i),10)+48,(j>1)*')'); end,c=strcat(c,(j<1)*ones(l)*')');if eval(c(1,:))==n,fprintf('%s%s%s%s\n',c(1,1:(j==1)*numel(c(1,:))),fliplr(a(k,1:(j>1)*l)),(j~=1)*num2str(n),a(k,1:(j<1)*l));end,end,end

try it here
http://octave-online.net/

still more improvements needed

people are not habitual with matlab here ?

Python 2, 303 bytes
Try it online
from itertools import*
n=input()
l=len(n)-1
E=eval
for c in product('+-*/^',repeat=l):
 L=lambda x,y:x.join(map(y.join,zip(n,c+('',)))).replace('^','**')
 C=''.join(c)
 try:
    if`E(L('',''))`==n:print L('','')
    if`E('('*-~l+L('',')'))`==n:print C[::-1]+n
    if`E(L('(','')+')'*l)`==n:print n+C
 except:pass

Infix output will contain ** instead of ^. If this is not allowed, .replace('**','^') will occure and add another 18 bytes
Explanation:
# get all possible combinations of operators (with repetitions)
product('+-*/^',repeat=l)

# create string from input and operators like
# if passed '(' and '' will return (a+(b+(c
# if passed '' and ')' will return a)+b)+c)
# if passed '' and '' will return a+b+c
lambda x,y:x.join(map(y.join,zip(n,c+('',)))).replace('^','**')

# evaluate infix
E(L('',''))
# evaluate prefix
E('('*-~l+L('',')'))
# evaluate postfix
E(L('(','')+')'*l)
# all evals need to be inside try-except to handle possible 0 division

# prefix output is need to be swapped (which IMO is not needed)
n:print C[::-1]+n


text:
How could I reduce the length of this code?
I need to reduce the length of this code in Python 3 as much as possible (even if it will be less readable):
a,b,x,y=[int(i) for i in input().split()]
while 1:
 r=''
 if y<b:r='S';y+=1
 if y>b:r='N';y-=1
 if x<a:r+='E';x+=1
 if x>a:r+='W';x-=1
 print(r)

It's a map: you are on (x,y) and you need to go to (a,b). S for South, N for North, NE for North East and so on. After each turn I must tell where to go using print.
Update: This is what I've got now, but is there any way to shorten it further?
a,b,x,y=map(int,input().split())
while 1:c,d=(y>b)-(y<b),(x>a)-(x<a);print((' NS'[c]+' WE'[d]).strip());y-=c;x-=d

This never terminates. Is that OK?

Yes. In fact, it will automatically end when x=a and y=b

How strict is the form of the input? For example if you are allowed to take input as "[4,5,1,2]" you could change the first line to a much shorter a,b,x,y=input()

it's really too bad they got rid of cmp() in python 3, this is a perfect use case.

Python 3, 107
a,b,x,y=map(int,input().split())
A=abs(a-x);B=abs(b-y)
while 1:print('SN'[b>y][:B]+'WE'[a>x][:A]);A-=1;B-=1

A different strategy to generate the directions, tracking each coordinate's absolute displacement to the goal rather than the actual location.
For the horizontal direction, finds the absolute displacement A=abs(a-x) and direction character 'WE'[a>x]. Simulates going towards the goal by decrementing A and printing the direction character as long as we haven't already reached the goal coordinate (A>0). Does the same for vertical.

Theres a shorter way to strip():
(' NS'[c]+' WE'[d]).strip()
c%2*' NS'[c]+d%2*' WE'[d]

saves two characters.

In Python 2, you could use cmp, which returns -1, 0, or 1. Use this result to get the correct letter.
while 1:c=cmp(y,b);d=cmp(x,a);print((' SN'[c]+' WE'[d]).strip());y-=c;x-=d

Martin Büttner suggested saving the cmp results to variables, and isaacg noted that now the whole loop can be on one line.
Unfortunately, Python 3 doesn't have cmp, but using (y>b)-(y<b) for cmp(y,b) is still shorter than the original.

Thank you but how do you use the function cmp ?

"cmp(x,y): Compare the two objects x and y and return an integer according to the outcome. The return value is negative if x < y, zero if x == y and strictly positive if x > y." From the Python documentation. link

@Bonsaigin That's a Python 2 documentation link.

I decided to fix up the answer to make it relevant and undelete it, as it was an important part in reducing the size of the original.

cc: @isaacg  see above comment

There's a shorter way to take the initial input:
a,b,x,y=[int(i) for i in input().split()]
a,b,x,y=map(int,input().split())

Thanks to @DenDenDo, for pointing out that you can do tuple unpacking assignment on map objects.

You dont even need list(), simply a,b,x,y=map(int,input().split())


text:
How can I use cmp(a,b) with Python3?
I was told that using the cmp function can be very useful in code-golf. But unfortunately, Python 3 doesn't have a cmp function.
So what's the shortest equivalent of cmp that works in python 3?

You should clarify that you are looking for cmp or an alternative in the context of golfing. Otherwise, this might get closed as a general programming question very quickly.

@MartinBüttner I think this is in context of the OP's golf advice question where an answer used cmp though the question asked for Python 3.

@xnor I know it is, but others might not.

If it is helpful to know, you can use cmp(a,b) in Python 2.

Python 3 does not have cmp. For golfing, you can do
11 chars
(a>b)-(a<b)

which loses 3 chars over cmp(a,b).
Amusingly, this is also an "official" workaround. The What's New in Python 3 page says "(If you really need the cmp() functionality, you could use the expression (a > b) - (a < b) as the equivalent for cmp(a, b).)"

beware precedence problems! the actual equivalent of cmp(a,b) is ((a > b) - (a < b))

if a or b are more complex expressions - say calls to functions with very long running times, then this is very bad for your running time.
Worse, if a or b contains a call to a function with side-effects, this can even change the semantic of your program.

@Algoman Oh noes, running time, the most important part of code-golfing /s. If you want to avoid running functions twice, just assign them to variables beforehand (which you're probably going to end up doing anyway to save on bytes)

I'm working on a transpiler - it reads an expression and is supposed to generate an expression out of it. That cmp in the original expression could be nested deeply. it would be very ugly and hard (if not impossible) to implement, if I were to generate the target-code like that.

But mostly, I think computing something beforehand and storing the result in a variable is bad style - that's how you program in assembler or COBOL. In higher-level languages, you should be able to nest things. So the removal of the cmp function is a step in the wrong direction.

@Algoman So replace cmp(exp1,exp2) with (lambda a,b:(a>b)-(a<b))(exp1,exp2).

@AndersKaseorg that's a good idea. Still rather ugly in comparison to plain cmp, but better - Thanks :-). I will probably just put my own cmp function into a library and use that, though. :-/