Probability to win a hand of poker (Texas hold 'em)
Python (not golfed)

import itertools as t

values = '23456789TJQKA'
suits = 'HDCS'

def value(c):
    return values.find(c[0])

def suit(c):
    return c[1]

def amounts(h):
    vals = map(value, h)
    return [vals.count(v) for v in set(vals)]

def score(h):
    vals = sorted(map(value, h))
    return sum(len(values)**i * v for i, v in enumerate(vals))

def straightFlush(h):
    return straight(h) and flush(h)

def fourOfAKind(h):
    return 4 in amounts(h)

def fullHouse(h):
    return 3 in amounts(h) and 2 in amounts(h)

def flush(h):
    return len(set(map(suit, h))) == 1

def straight(h):
    vals = sorted(map(value, h))
    if vals[0] == 0 and vals[-1] == len(values) - 1: #if there's a two and an ace
        vals = vals[:-1] #then remove the ace
    return map(lambda x: x + 1, vals[:-1]) == vals[1:]

def threeOfAKind(h):
    return 3 in amounts(h)

def twoPair(h):
    return amounts(h).count(2) == 2

def pair(h):
    return 2 in amounts(h)

def highCard(h):
    return True

def compare(h1, h2): #return True if h1 wins, False otherwise
    funcs = [straightFlush, fourOfAKind, fullHouse, flush, straight, threeOfAKind, twoPair, pair, highCard]
    for f in funcs:
        r1, r2 = f(h1), f(h2)
        if r1 and not r2:
            return True
        elif r2 and not r1:
            return False
        elif r1 and r2:
            s1, s2 = score(h1), score(h2)
            if s1 &gt; s2:
                return True
            elif s2 &gt; s1:
                return False
    return False #tie case

def bestHand(cards):
    hands = list(t.combinations(cards, 5))
    bestHand = hands[0]
    for h in hands:
        if compare(h, bestHand):
            bestHand = h
    return bestHand

visible = input().split()
table = tuple(visible[2:])
visible = set(visible)
deck = set([c[0] + c[1] for c in t.product(values, suits)]) - visible

hand = bestHand(visible)

wins = 0
total = 0
for c1 in deck:
    for c2 in deck:
        if c1 == c2:
            break
        otherHand = bestHand(table + (c1, c2))
        if compare(hand, otherHand):
            wins += 1
        total += 1

print '%.2f' % (float(wins) / total)

#use examples
# input "AH 7C  KH QH JH TH 6C" --&gt; 1.00
# input "9H 7C  KH QH JH TH 6C" --&gt; 0.96


Could obviously be immensely shorter but there's not much competition yet. I prefer it this way; simple and readable. It counts ties as losses.