text:
Help our robots reach the teleporter
UPDATE: Added a Python framework to get started.
The space-station has been overtaken by crusher-bots. You must direct as many of
our expensive and fragile tech-bots called "rabbits" to an exit teleporter
before the station self-destructs, but the crusher-bots are patrolling the
corridors.
Your program is given an ASCII map, and each turn is told where the crusher-bots
are and your current rabbits are. Your program should then move your rabbits
toward the exit teleporter while avoiding the crusher-bots.

Execution
Run the Python 2 controller with:
python controller.py <mapfile> <turns> <seed> <runs> <prog>...
<prog> can be <interpreter> <yourprog> or similar.

The seed is a small integer used for the crusher and your program PRNG so that runs are
repeatable. Your program should perform consistently regardless of the actual
seed used. If seed is zero, the controller will use a random seed for each run.
The controller will run your program with the name of the map text file and seed
as arguments. Eg:
perl wandomwabbits.pl large.map 322

If your program uses a PRNG, you should initialise it with the
given seed. The controller then sends your program updates through STDIN and
reads your rabbit movements through STDOUT.
Each turn the controller will output 3 lines:
turnsleft <INT>
crusher <x,y> <movesto|crushes> <x,y>; ...
rabbits <x,y> <x,y> ...

then waits for the program to output one line:
move <x,y> to <x,y>; ...

UPDATE: Your program will have 2 seconds to initialise before the first lines are sent by the controller.
If your program takes longer than 0.5 seconds to respond with moves after the
controller rabbit location input, the controller will exit.
If there are no rabbits on the grid, the rabbits line will have no  values, and your program should output a bare "move" string line.
Remember to flush your program output stream each turn or the controller may
hang.
Example
prog input:
turnsleft 35
crusher 22,3 crushes 21,3; 45,5 movesto 45,4
rabbits 6,4 8,7 7,3 14,1 14,2 14,3

prog output:
move 14,3 to 14,4; 14,2 to 14,3; 6,4 to 7,4

Controller logic
The logic for each turn:

if turns left is zero, print score and exit.
for each empty start cell, add a rabbit if no crusher in sight.
for each crusher, decide move direction (see below).
for each crusher, move if possible.
if crusher is at a rabbit location, remove rabbit.
output turnsleft, crusher actions, and rabbit locations to program.
read rabbit move requests from program.
if a rabbit not exist or move not possible, skip.
plot each new location of rabbits.
if rabbit hits a crusher, rabbit is destroyed.
if rabbit is in exit teleporter, rabbit is removed and score increased.
if rabbits collide, they are both destroyed.

Each crusher always has a heading direction (one of NSEW). A crusher follows this
navigation logic each turn:

If one or more rabbits are visible in any of 4 orthogonal directions, change
direction to one of the closest rabbits. Note that crushers cannot see past
another crusher.
else choose randomly between open forward,left,right options if possible.
else if obstacles (wall or other crusher) in front, left, and right, set direction
to behind.

Then for each crusher:

If there is no obstacle in new crusher direction, move (and possibly crush).

The map symbols
The map is a rectangular grid of ASCII characters. The map is made up of walls
#, corridor spaces , rabbit start positions s, exit teleporters e, and
crusher starting locations c. The top left corner is location (0,0).
Small map
###################
#        c        #
# # ######## # # ##
# ###s    #  ####e#
#   # # # ## ##   #
### # ###  # ## # #
#         ##      #
###################

Test map
#################################################################
#s                       ############################          s#
## ## ### ############ # #######                ##### ####### ###
## ## ### #            # ####### ########## # # ####   ###### ###
## ## ### # ############ ####### ##########     ##### ####### ###
## ## ##  #              ####### ########## # # ##### ####      #
##    ### #### #### ########     ##########     ##### #### ## ###
######### ####      ######## ################ ####### ####    ###
#########  ################# ################   c     ####### ###
######### ##################          ####### ####### ###########
######### ################## ######## #######         ###########
##### ###   c                          ###### ###################
#         #### ### # # # # # # # # # # ###### ##############    #
# ####### ####                         ###    ####     ##### ## #
#         #### ### # # # # # # # # # # ### # ###   #########    #
##### ### #### ###                   #####   ### #  ######## ####
############## ### # # # # # # # # # # #######   ##  ####### ####
#### #### #### ###                     ###   # # ###  ###### ####
##             ### # # # # # # # # # # ### ### #  ###  ##### ####
##### ######## ### # # # ##### # # # # ### ### # #####  #### ####
##### ##### ######         c   #       ### ###   ######  ### ####
##       c   ######################### ### ##### ####### ### ####
##### # ### #######   ########         ### ##### c  ##    ## ####
#####   #   ####### ########## ## ######## #     ######## ## ####
######### # #######            ## #     ## # # # #####     # ####
### ##### #     ### # ############## # ### #      ###  ## #  ####
#      ## # ### ### # ############## # ### ##### #####    ## ####
### ## ## #     ###                  #           ########       #
#s  ##      ###################################################e#
#################################################################

Example large map run

Score
To evaluate your program, run the controller with the test map, 500 turns,
5 runs, and seed of 0. Your score is the total number of rabbits successfully
teleported off the station to safety. In the event of a tie, the answer with the
most votes will win.
Your answer should include a title with entry name, language used, and score. In
the answer body, please include the controller score output complete with seed
numbers so that others can repeat your runs. For example:
Running: controller.py small.map 100 0 5 python bunny.py
   Run                 Seed      Score
     1                  965          0
     2                  843          6
     3                  749         11
     4                  509         10
     5                  463          3
Total Score: 30

You can use standard and freely available libraries but the standard loopholes
are forbidden. You must not optimise your program for a given seed, turn count,
map feature set, or other parameters. I reserve the right to change the map,
turn count, and seed if I suspect a violation of this rule.
Controller code
#!/usr/bin/env python
# Control Program for the Rabbit Runner on PPCG.
# Usage: controller.py <mapfile> <turns> <seed> <runs> <prog>...
# Tested on Python 2.7 on Ubuntu Linux. May need edits for other platforms.
# v1.0 First release.
# v1.1 Fixed crusher reporting bug.
# v1.2 Control for animation image production.
# v1.3 Added time delay for program to initialise

import sys, subprocess, time, re, os
from random import *

# Suggest installing Pillow if you don't have PIL already
try:
    from PIL import Image, ImageDraw
except:
    Image, ImageDraw = None, None
GRIDLOG = True      # copy grid to run.log each turn (off for speed)
MKIMAGE = False     # animation image creation (much faster when off)
IMGWIDTH = 600      # animation image width estimate
INITTIME = 2        # Allow 2 seconds for the program to initialise

point = complex     # use complex numbers as 2d integer points
ORTH = [1, -1, 1j, -1j]     # all 4 orthogonal directions

def send(proc, msg):
    proc.stdin.write((msg+'\n').encode('utf-8'))
    proc.stdin.flush()

def read(proc):
    return proc.stdout.readline().decode('utf-8')

def cansee(cell):
    # return a dict of visible cells containing robots with distances
    see = {}    # see[cell] = dist
    robots = rabbits | set(crushers)
    if cell in robots:
        see[cell] = 0
    for direc in ORTH:
        for dist in xrange(1,1000):
            test = cell + direc*dist
            if test in walls:
                break
            if test in robots:
                see[test] = dist
                if test in crushers:
                    break       # can't see past them
    return see

def bestdir(cr, direc):
    # Decide in best direction for this crusher-bot
    seen = cansee(cr)
    prey = set(seen) & rabbits
    if prey:
        target = min(prey, key=seen.get)    # Find closest
        vector = target - cr
        return vector / abs(vector)
    obst = set(crushers) | walls
    options = [d for d in ORTH if d != -direc and cr+d not in obst]
    if options:
        return choice(options)
    return -direc

def features(fname):
    # Extract the map features
    walls, crusherstarts, rabbitstarts, exits = set(), set(), set(), set()
    grid = [line.strip() for line in open(fname, 'rt')]
    grid = [line for line in grid if line and line[0] != ';']
    for y,line in enumerate(grid):
        for x,ch in enumerate(line):
            if ch == ' ': continue
            cell = point(x,y)
            if ch == '#': walls.add(cell)
            elif ch == 's': rabbitstarts.add(cell)
            elif ch == 'e': exits.add(cell)
            elif ch == 'c': crusherstarts.add(cell)
    return grid, walls, crusherstarts, rabbitstarts, exits

def drawrect(draw, cell, scale, color, size=1):
    x, y = int(cell.real)*scale, int(cell.imag)*scale
    edge = int((1-size)*scale/2.0 + 0.5)
    draw.rectangle([x+edge, y+edge, x+scale-edge, y+scale-edge], fill=color)

def drawframe(runno, turn):
    if Image == None:
        return
    scale = IMGWIDTH/len(grid[0])
    W, H = scale*len(grid[0]), scale*len(grid)
    img = Image.new('RGB', (W,H), (255,255,255))
    draw = ImageDraw.Draw(img)
    for cell in rabbitstarts:
        drawrect(draw, cell, scale, (190,190,255))
    for cell in exits:
        drawrect(draw, cell, scale, (190,255,190))
    for cell in walls:
        drawrect(draw, cell, scale, (190,190,190))
    for cell in crushers:
        drawrect(draw, cell, scale, (255,0,0), 0.8)
    for cell in rabbits:
        drawrect(draw, cell, scale, (0,0,255), 0.4)
    img.save('anim/run%02uframe%04u.gif' % (runno, turn))

def text2point(textpoint):
    # convert text like "22,6" to point object
    return point( *map(int, textpoint.split(',')) )

def point2text(cell):
    return '%i,%i' % (int(cell.real), int(cell.imag))

def run(number, nseed):
    score = 0
    turnsleft = turns
    turn = 0
    seed(nseed)
    calltext = program + [mapfile, str(nseed)]
    process = subprocess.Popen(calltext,
            stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=errorlog)
    time.sleep(INITTIME)
    rabbits.clear()
    crushers.clear()
    crushers.update( dict((cr, choice(ORTH)) for cr in crusherstarts) )

    while turnsleft > 0:
        # for each empty start cell, add a rabbit if no crusher in sight.
        for cell in rabbitstarts:
            if cell in rabbits or set(cansee(cell)) & set(crushers):
                continue
            rabbits.add(cell)
        # write the grid to the runlog and create image frames
        if GRIDLOG:
            for y,line in enumerate(grid):
                for x,ch in enumerate(line):
                    cell = point(x,y)
                    if cell in crushers: ch = 'X'
                    elif cell in rabbits: ch = 'o'
                    runlog.write(ch)
                runlog.write('\n')
            runlog.write('\n\n')
        if MKIMAGE:
            drawframe(number, turn)
        # for each crusher, decide move direction.
        for cr, direc in crushers.items():
            crushers[cr] = bestdir(cr, direc)
        # for each crusher, move if possible.
        actions = []
        for cr, direc in crushers.items():
            newcr = cr + direc
            if newcr in walls or newcr in crushers:
                continue
            crushers[newcr] = crushers.pop(cr)
            action = ' movesto '
            # if crusher is at a rabbit location, remove rabbit.
            if newcr in rabbits:
                rabbits.discard(newcr)
                action = ' crushes '
            actions.append(point2text(cr)+action+point2text(newcr))
        # output turnsleft, crusher actions, and rabbit locations to program.
        send(process, 'turnsleft %u' % turnsleft)
        send(process, 'crusher ' + '; '.join(actions))
        rabbitlocs = [point2text(r) for r in rabbits]
        send(process, ' '.join(['rabbits'] + rabbitlocs))
        # read rabbit move requests from program.
        start = time.time()
        inline = read(process)
        if time.time() - start > 0.5:
            print 'Move timeout'
            break
        # if a rabbit not exist or move not possible, no action.
        # if rabbit hits a crusher, rabbit is destroyed.
        # if rabbit is in exit teleporter, rabbit is removed and score increased.
        # if two rabbits collide, they are both destroyed.
        newrabbits = set()
        for p1,p2 in re.findall(r'(\d+,\d+)\s+to\s+(\d+,\d+)', inline):
            p1, p2 = map(text2point, [p1,p2])
            if p1 in rabbits and p2 not in walls:
                if p2-p1 in ORTH:
                    rabbits.discard(p1)
                    if p2 in crushers:
                        pass        # wabbit squished
                    elif p2 in exits:
                        score += 1  # rabbit saved
                    elif p2 in newrabbits:
                        newrabbits.discard(p2)  # moving rabbit collision
                    else:
                        newrabbits.add(p2)
        # plot each new location of rabbits.
        for rabbit in newrabbits:
            if rabbit in rabbits:
                rabbits.discard(rabbit)     # still rabbit collision
            else:
                rabbits.add(rabbit)
        turnsleft -= 1
        turn += 1
    process.terminate()
    return score

mapfile = sys.argv[1]
turns = int(sys.argv[2])
argseed = int(sys.argv[3])
runs = int(sys.argv[4])
program = sys.argv[5:]
errorlog = open('error.log', 'wt')
runlog = open('run.log', 'wt')
grid, walls, crusherstarts, rabbitstarts, exits = features(mapfile)
rabbits = set()
crushers = dict()

if 'anim' not in os.listdir('.'):
    os.mkdir('anim')
for fname in os.listdir('anim'):
    os.remove(os.path.join('anim', fname))

total = 0
print 'Running:', ' '.join(sys.argv)
print >> runlog, 'Running:', ' '.join(sys.argv)
fmt = '%10s %20s %10s'
print fmt % ('Run', 'Seed', 'Score')
for n in range(runs):
    nseed = argseed if argseed else randint(1,1000)
    score = run(n, nseed)
    total += score
    print fmt % (n+1, nseed, score)
print 'Total Score:', total
print >> runlog, 'Total Score:', total

The controller makes a text log of the runs in run.log and a series of images
in the anim directory. If your Python installation can't find the PIL image
library (download as Pillow), no images will be generated. I have been animating
the image series with ImageMagick. Eg:
convert -delay 100 -loop 0 anim/run01* run1anim.gif

You are welcome to post interesting animations or images with your answer.
You can turn these features off and speed up the controller by setting GRIDLOG
= False and/or MKIMAGE = False in the first few lines of the controller program.
Suggested Python framework
To help get started, here is a framework in Python. The first step is to read in the map file and find paths to the exits. In each turn there should be some code to store where the crushers are, and code that decides where to move our rabbits. The simplest strategy to start with is moving the rabbits towards an exit ignoring the crushers -- some rabbits might get through.
import sys, re
from random import *

mapfile = sys.argv[1]
argseed = int(sys.argv[2])
seed(argseed)

grid = [line.strip() for line in open(mapfile, 'rt')]
#
# Process grid to find teleporters and paths to get there
#

while 1:
    msg = sys.stdin.readline()

    if msg.startswith('turnsleft'):
        turnsleft = int(msg.split()[1])

    elif msg.startswith('crusher'):
        actions = re.findall(r'(\d+),(\d+) (movesto|crushes) (\d+),(\d+)', msg)
        #
        # Store crusher locations and movement so we can avoid them
        #

    elif msg.startswith('rabbits'):
        moves = []
        places = re.findall(r'(\d+),(\d+)', msg)
        for rabbit in [map(int, xy) for xy in places]:
            #
            # Compute the best move for this rabbit
            newpos = nextmoveforrabbit(rabbit)
            #
            moves.append('%u,%u to %u,%u' % tuple(rabbit + newpos))
        print 'move ' + '; '.join(moves)
        sys.stdout.flush()

Is it allowed to simulate the controller, with the exact same RNG? This would effectively make the crushers deterministic, allowing you to predict their behaviour and avoid them. Hell, you could probably make one or a few 'bait rabbits' to keep the crushers busy while setting up an unbothered highway of rabbits

No, you may not simulate the RNG (or record it for a particular seed). The crushers are designed to be NOT deterministic, so this is a code challenge to make a strategy that is likely to avoid them. The 'bait rabbit' idea is certainly ok though. I am expecting some strategies involving sacrificial rabbits.

If seed is 0, won't each run use a random seed?

Yes. If the controller seed is zero, it will use (and issue to the test program) a random seed for each run. This seed is reported with the score of the run. Feeding this seed back into the controller should cause that exact run (and score) to be verified. It is a bit complex, but it was the best way I could figure to enable replicating runs (deterministic) and allow randomness in controller and test program behaviour.

Crazy, Python 45
I did 25 runs with random seed, my computer isn't fast enough to go for 1000 (if someone want to correct the score)
First program in python, it was a pain to debug for me. Also I don't know if I used it well.
It uses a breadth-first algorithm from the exit, one taking into account the crushers, the other without. I had a lot of timeout so I didn't go for something more complex (one crusher removal, etc.). The rabbits also go crazy if there is a crusher nearby in the hope to make it go to a wrong path.
import sys, re
from random import *

mapfile = sys.argv[1]
argseed = int(sys.argv[2])
seed(argseed)

grid = [line.strip() for line in open(mapfile, 'rt')]
width = len(grid[0])
height = len(grid)

starts = set([])
end = ()
walkables = set([])
crushers = set([])
#
# Process grid to find teleporters and paths to get there
#
for a in range(height):
    for b in range(width):
        if grid[a][b] == 'e':
            end = (b,a)
            walkables.add((b,a))
        elif grid[a][b] == 's':
            starts.add((b,a))
            walkables.add((b,a))
        elif grid[a][b] == 'c':
            crushers.add((b,a))
            walkables.add((b,a))
        elif grid[a][b] == ' ':
            walkables.add((b,a))

toSearch = [ (end, 0) ]
inSearch = [ end ]
visited = set([])
gradient = [[0]*height for x in range(width)]
while len(toSearch) > 0 :
    current = toSearch.pop(0)
    (row, col) = current[0]
    length = current[1]
    visited.add(current[0])
    neighbors = {(row+1,col),(row-1,col),(row,col+1),(row,col-1)}
    neighborSpaces = walkables & neighbors
    unvisited = neighborSpaces - visited
    for node in unvisited:
        if not node in inSearch:
            gradient[node[0]][node[1]]=[current[0][0],current[0][1]]
            inSearch.append(node)
            toSearch.append((node, length+1))
    toSearch.sort(key=lambda node: node[1])

while 1:
    msg = sys.stdin.readline()

    if msg.startswith('turnsleft'):
        turnsleft = int(msg.split()[1])

    elif msg.startswith('crusher'):
        # Update crushers
        actions = re.findall(r'(\d+),(\d+) (movesto|crushes) (\d+),(\d+)', msg)
        for one_action in actions:
            crushers.discard((int(one_action[0]),int(one_action[1])))
            crushers.add((int(one_action[3]),int(one_action[4])))

    elif msg.startswith('rabbits'):
        toSearch = [ (end, 0) ]
        inSearch = [ end ]
        visited = set([])
        gradient2 = [[0]*height for x in range(width)]
        while len(toSearch) > 0 :
            current = toSearch.pop(0)
            (row, col) = current[0]
            length = current[1]
            visited.add(current[0])
            neighbors = {(row+1,col),(row-1,col),(row,col+1),(row,col-1)}
            neighborSpaces = (walkables - crushers) & neighbors
            unvisited = neighborSpaces - visited
            for node in unvisited:
                if not node in inSearch:
                    gradient2[node[0]][node[1]]=[current[0][0],current[0][1]]
                    inSearch.append(node)
                    toSearch.append((node, length+1))
            toSearch.sort(key=lambda node: node[1])
        moves = []
        places = re.findall(r'(\d+),(\d+)', msg)
        for rabbit in [map(int, xy) for xy in places]:
            # If any crushers insight, go crazy to lose him
            directions = [(1,0),(-1,0),(0,1),(0,-1)]
            crazy = False
            newpos = 0
            for direction in directions:
                (row, col) = rabbit
                sight = 0
                while len({(row,col)} & walkables)>0 and sight<5 and crazy == False:
                    sight+=1
                    if (row,col) in crushers:
                        directions.remove(direction)
                        crazy = True
                    (row,col) = (row+direction[0],col+direction[1])
            for direction in directions:
                if not (rabbit[0]+direction[0],rabbit[1]+direction[1]) in walkables:
                    directions.remove(direction)
            if len(directions)==0:
                directions = [(1,0),(-1,0),(0,1),(0,-1)]
            direction = choice(directions)
            newpos = [rabbit[0]+direction[0],rabbit[1]+direction[1]]
            # Else use gradients
            if crazy == False:
                newpos = gradient2[rabbit[0]][rabbit[1]]
                if newpos == 0:
                    newpos = gradient[rabbit[0]][rabbit[1]]
            moves.append('%u,%u to %u,%u' % tuple(rabbit + newpos))
        print 'move ' + '; '.join(moves)
        sys.stdout.flush()

I think you may have errors in your indentation. Leading white space is important in Python. eg: the walkables.add((b,a)) lines.

should work fine now

Bunny, Java, 26.385
I averaged the scores of runs 1 to 1000 and multiplied by 5 to get my score. I'm pretty sure this is equivalent to the average score over all possible games with the standard options.
Scores
import java.awt.Point;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.*;
import java.util.stream.Collectors;

public class Main {

    private static final char WALL = '#';
    private static final char CRUSHER = 'c';
    private static final char ESCAPE = 'e';
    private static final char HUTCH = 's';

    private int height;
    private int width;

    private char[][] map;
    private List<Point> escapes = new ArrayList<>();
    private List<Point> crushers = new ArrayList<>();
    private List<Point> rabbits = new ArrayList<>();
    private List<Point> hutches = new ArrayList<>();

    private BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    private PrintStream out = System.out;
    private int[][] distances;

    public Main(String[] args) throws Exception {
        loadMap(args[0]);
    }

    private void loadMap(String mapFileName) throws Exception {
        char[][] preMap = new BufferedReader(new FileReader(mapFileName))
                .lines()
                .map(String::toCharArray)
                .toArray(char[][]::new);

        width = preMap[0].length;
        height = preMap.length;

        map = new char[width][height];    //tranpose

        for (int x = 0; x < width; x++){
            for (int y = 0; y < height; y++){
                map[x][y] = preMap[y][x];
            }
        }

        processMap();

        distances = dijkstra();

    }

    private void processMap() {
        for (int x = 0; x < width; x++){
            for (int y = 0; y < height; y++){
                char c = map[x][y];
                Point p = new Point(x, y);
                if (c == CRUSHER){
                    crushers.add(p);
                }
                if (c == ESCAPE){
                    escapes.add(p);
                }
                if (c == HUTCH){
                    hutches.add(p);
                }
            }
        }
    }

    public static void main(String[] args) throws Exception {
        new Main(args).run();
    }

    private void run() throws Exception{
        while (true) {
            in.readLine();
            readCrushers();
            readRabbits();
            makeDecision();
        }
    }

    private void makeDecision() {
        Map<Point, Point> moves = new HashMap<>();

        for (Point rabbit : rabbits){
            Point bestDirection = null;
            for (Point p : pointsAroundInclusive(rabbit)){
                if (
                        (bestDirection == null ||
                                distances[p.x][p.y] < distances[bestDirection.x][bestDirection.y]
                        ) && !moves.entrySet().contains(p)){
                    bestDirection = p;
                }
            }
            if (bestDirection != null) {
                moves.put(rabbit, bestDirection);
            }
        }

        out.println("move" +
                moves.entrySet().stream().map(a -> {
                    Point l0 = a.getKey();
                    Point l1 = a.getValue();
                    return " " + l0.x + "," + l0.y + " to " + l1.x + "," + l1.y;
                }).collect(Collectors.joining(";")));
    }

    private List<Point> pointsAroundInclusive(Point point) {
        List<Point> result = pointsAroundExclusive(point);
        result.add(point);
        return result;
    }

    private int[][] dijkstra() {
        Queue<Point> queue = new LinkedList<>();
        Set<Point> scanned = new HashSet<>();
        queue.addAll(escapes);
        scanned.addAll(escapes);

        int[][] distances = new int[width][height];

        while (!queue.isEmpty()) {
            Point next = queue.remove();
            int distance = distances[next.x][next.y];

            pointsAroundExclusive(next).stream()
                    .filter(p -> !scanned.contains(p))
                    .forEach(p -> {
                        distances[p.x][p.y] = distance + 1;
                        scanned.add(p);
                        queue.add(p);
                    });
        }

        return distances;
    }

    private List<Point> pointsAroundExclusive(Point p) {
        Point[] around = new Point[]{
                new Point(p.x - 1, p.y),
                new Point(p.x + 1, p.y),
                new Point(p.x, p.y - 1),
                new Point(p.x, p.y + 1)
        };

        List<Point> result = new ArrayList<>(Arrays.asList(around));
        result.removeIf(a -> {
            if (a.x < 0 || a.x >= width){
                return true;
            }
            if (a.y < 0 || a.y >= height){
                return true;
            }
            char c = map[a.x][a.y];
            return c == WALL;
        });

        return result;
    }

    private void readRabbits() throws Exception {
        String[] locations = in.readLine().substring("rabbits".length()).trim().split("\\s");
        rabbits.clear();

        for (String location : locations){

            if (location.equals("")){
                continue;
            }

            String[] decomposed = location.split(",");

            int x = Integer.parseInt(decomposed[0]);
            int y = Integer.parseInt(decomposed[1]);

            rabbits.add(new Point(x, y));
        }

    }

    private void readCrushers() throws Exception {
        String[] locations = in.readLine().substring("crusher".length()).trim().split("(; )?\\d+,\\d+ (movesto|crushes) ");
        crushers.clear();

        for (String location : locations){

            if (location.equals("")){
                continue;
            }

            String[] decomposed = location.split(",");

            int x = Integer.parseInt(decomposed[0]);
            int y = Integer.parseInt(decomposed[1]);

            crushers.add(new Point(x, y));
        }
    }

}

The best run tested has seed 1000. Here's a GIF of it:


text:
Generate The SUDSI Sequence
The SUDSI sequence (sum, difference, swap, increment) is a curious integer sequence that appears to exhibit rather chaotic behavior. It can be generated as follows:
Let S be an infinite list of the natural numbers: 1 2 3 4 5 6 .... Let Si denote the one-indexed ith element of S. So initially,  S1 is 1, S2 is 2, etc. (there is no S0).
Starting with S1 and S2 ...

Compute their sum: sum = S1 + S2

Compute their absolute difference (the larger one minus the smaller one): diff = |S1 - S2|

Swap the two values in S at the indices of the sum and difference: swap(Ssum, Sdiff)

Increment the indices of S you are working with. So next time you will compute the sum and difference of S2 and S3, and the time after that it will be S3 and S4, etc.

Repeat this process indefinitely.

Here are the first few stages of S as this process is applied. The brackets [] surround the two values that are about to be summed and differenced.
Original S:
[1 2] 3 4 5 6 7 8 9 10 11 12 ...

After S3 (3 = 1 + 2) and S1 (1 = |1 - 2|) are swapped:
3 [2 1] 4 5 6 7 8 9 10 11 12 ...

After S3 and S1 are swapped:
1 2 [3 4] 5 6 7 8 9 10 11 12 ...

After S7 and S1 are swapped:
7 2 3 [4 5] 6 1 8 9 10 11 12 ...

After S9 and S1 are swapped:
9 2 3 4 [5 6] 1 8 7 10 11 12 ...

After S11 and S1 are swapped:
11 2 3 4 5 [6 1] 8 7 10 9 12 ...

After S7 and S5 are swapped:
11 2 3 4 1 6 [5 8] 7 10 9 12 ...

etc.
The SUDSI sequence is defined as the sequence of the first elements in each of these lists. So the first few terms of the SUDSI sequence are 1 3 1 7 9 11 11.
Here are the first 200 terms of the SUDSI sequence (20 per line):
1 3 1 7 9 11 11 11 15 15 19 19 19 19 19 19 19 19 19 19
19 19 19 19 19 19 19 19 57 59 59 59 59 59 59 59 59 59 77 79
81 83 85 87 89 91 91 91 91 91 91 91 91 91 91 91 91 91 115 115
121 123 125 127 127 127 127 127 137 139 141 143 145 147 147 147 147 147 147 147
147 147 147 147 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167
167 167 167 167 209 211 211 211 211 211 221 223 223 223 223 223 223 223 223 223
223 223 243 243 243 243 243 243 257 259 261 263 263 263 263 263 263 263 263 263
263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263
263 263 325 327 329 331 331 331 331 331 331 331 331 331 349 351 351 351 351 351
361 363 363 363 363 363 363 363 363 363 363 363 363 363 363 363 363 363 363 363

It is unclear (to me at least) how one might predict future terms. It only feels safe to say that that the terms are always odd, non-decreasing (after the second term), and that some numbers are repeated lots of times.
Challenge
Write a program or function that takes in a positive integer n and prints or returns the nth term of the SUDSI sequence. For example, if n is 1, the output is 1, if n is 2, the output is 3, if n is 200, the output is 363.
Take input in any usual way (stdin/command line/function arg).
The shortest answer in bytes wins.
(That site encodes things in UTF-8, but you may use any darn existing encoding you want.)
Mathy bonus: (potentially eligible for bounty)

Tell me more about the SUDSI sequence. What's the underlying pattern to what numbers are part of it and how many of them there are (and stuff like that)? (I couldn't find SUDSI on OEIS by the way.)

As again . Better not link than creating confusion about encoding.

@Optimizer I've been linking to that byte counter with the same phrasing for ages. Why would it suddenly cause more confusion than it ever did?

I have no idea that you have been doing this from ages. But think about it, if someone links the count from that url for an APL answer, it will definitely be wrong.

@Optimizer Well hopefully APL users know about that caveat. (And I've never had one ask.) Providing a general purpose byte counter seems like a reasonable thing to do.

@Calvin'sHobbies I think a better byte counter would be some HTML5 file form thingy where you can drag and drop a (binary, APL, UTF8, whatever-you-want-encoding) file.

@orlp I guess that would be a nice additional feature, but I personally rely on being able to copy-paste since I rarely have source files for my submissions.

@orlp But who will need that anyway? They can see the size directly if they had the file. And it is not that easy to remove the newline in the end in some operating systems.

@MartinBüttner I was bored: http://meta.codegolf.stackexchange.com/questions/4944/byte-counter-snippet

Pyth, 45 41 40 38 bytes
MXGH_HhugGm@Gtd,s<>GH2.a-@GH@GhHtQr1yQ

I noticed (as did Martin Büttner), that the maximum affected number of a permutation step at k is 2k + 1. But since we only have n - 1, steps, we only need a list of the numbers up to 2n - 1.
Try it online: Demonstration
M                       define a function g(G, H): return
                        (G is the list of numbers, H is a tuple)
 XGH_H                     a translation of G
                           (replaces the elements in H with the elements in reversed H)
                           in this application it swaps two values in the list G

                        implicit: Q = input()
 u     tQr1yQ           reduce, G = [1, 2, ..., 2*Q-1]
                        for each H in [0, 1, ..., Q - 2]:
                           G =
  gG...                        g(G, ...)
h                       print the first element of the resulting list

And the second argument ... of the function call g is:

     ,                  create the tuple (
      s<>GH2               sum(G[H:][:2]),
            .a-@GH@GhH     abs(G[H],G[H+1])
                        )
m@Gtd                   and map each value d to G[d - 1]

Is there a fine for using Pyth outside of a library?

@Alex A. Haha, no. But there's one for not returning books.

Mathematica, 88 bytes
Last[f@n_:=n;(r=f@1;{f@a,f@b}={f[b=+##],f[a=Abs[#-#2]]};r)&@@f/@{#,#+1}&/@Range@Input[]]

This is a full program, reading the input from a prompt. It's a very direct implementation of the definition, where I'm keeping track of the current sequence in f (whose values f[n] default to n).
Here is a slightly more readable version:
Last[
  f@n_ := n;
  (
    r = f@1;
    {f@a,f@b} = {f[b=+##],f[a=Abs[#-#2]]};
    r
  ) & @@ f /@ {#,#+1} & /@ Range @ Input[]
]

Some analysis
I've plotted the first 2000 elements of the sequence (it doesn't really get more interesting afterwards):

So the sequence is essentially linear with slope 2 and always has a few of those steps. It seems that the steps grow sublinearly (if they aren't even bounded), since they become barely noticeable as you increase the number of points you plot.
We can justify the linear growth quite easily (this is a bit handwavy, but I think it would hold up to a rigorous proof by induction): initially, the maximum affected number of a permutation step at n is n + (n+1) = 2n + 1. Also note that these numbers will always be moved to 1, since |n - (n+1)| = 1. So it's not surprising that we get numbers which are approximately 2n in the sequence. However, we can also note that for steps up to n, Sn+1 is always bounded by n+1, which means that no swapping step can swap two numbers which are both greater than n. Hence, numbers that still need to be processed will be less than or equal to their initial value. Hence, 2n + 1 is also the bound for the sequence itself.
I think finding an argument for the length of the steps will be trickier.

+1 for a good solution but mostly for the very interesting and informative analysis!

CJam, 45 40 39 bytes
Just a naive approach. Can be golfed further. Missing a array swap function too much.
ri_K*,\{\:L>2<L1$:+:S@:-z:DL=tDSL=t}/1=

How it works:
ri_                             "Read the input, convert to integer and copy it";
   K*,                          "Multiply the copy by 20 and get 0 to 20*input-1 array";
      \{ ... }/1=               "Swap and put input on stack and run the loop that many";
                                "times. After the loop, take the second element as";
                                "we have a 0 based array while series is 1 based";
{\:L>2<L1$:+:S@:-z:DL=tDSL=t}
 \:L                            "Swap to put iteration index behind the array";
                                "and store array in L";
    >2<                         "In each loop, the iteration index will be on stack";
                                "Get the two elements from the array starting at that";
       L1$                      "Put the array on stack and copy the tuple";
          :+:S                  "Get the sum and store it in S";
              @:-z:D            "Get the absolute difference of the tuple and store in D";
                    L=t         "Put the element at S diff at sum index";
                       DSL=t    "Put the element at S sum at diff index";

Try it online here

Haskell, 95 bytes
f#n=let b=f$n+1;l=f n+b;r=abs$f n-b;y x|x==l=f r|x==r=f l|1<2=f x in y
p n=foldl(#)id[1..n-1]$1

Usage example: p 70 -> 139
I do not store the sequence in a list or array. I repeatedly update the identity function to a function with the two elements of the current step swapped. After n steps I call the resulting function with parameter 1.

J, 63 bytes
3 :'{.>((1-~{(+,|@-)]{~1+[)|.@:{`[`]}])&.>/(<"*i.1-y),<>:i.3*y'

Usage and tests:
   f=.3 :'{.>((1-~{(+,|@-)]{~1+[)|.@:{`[`]}])&.>/(<"*i.1-y),<>:i.3*y'

   f 5
9
   f every 1+i.20
1 3 1 7 9 11 11 11 15 15 19 19 19 19 19 19 19 19 19 19

Try it online here.

Python 2, 117 106 101
j=input();a=range(3*j)
for i in range(1,j):b,c=a[i:i+2];d=abs(b-c);a[b+c],a[d]=a[d],a[b+c]
print a[1]

Uses a dict (map) to save the values to use arbitrary indices. g(n) is a function returning the nth item. Then just iterates input-1 times and outputs the first item.
It turns out it's shorter using the methods from my Pyth answer.
Thanks to xnor for saving 5 bytes.

You can use list unpacking: b,c=a[i:i+2]. Also, b+c is short enough that saving it to a variable s loses chars over just writing it twice.

Pyth, 55 53 51
Can probably be golfed further. Might get really slow for large n as I was lazy to figure out how long of an array I'd need and just used a n^n one.
Thanks to Volatility and Martin Büttner for pointing out that I can use a maximum of 3n.
KU*3QFNr1QJ@KN=G@tKNAJG,+JG.a-JG=Y@KJ XXKJ@KGGY)@K1

Explanation
                   Q = input (implicit)
KU*3Q              K = range(3 * Q)
FNr1Q              for N in range(1, Q):
 J@KN               J = K[N]
 =G@tKN             G = K[1:][N]
 AJG,+JG.a-JG       J, G = J + G, abs(J - G)
 =Y@KJ              Y = K[J]
 XXKJ@KGGY          K[J], K[G] = K[G], Y
)
@K1                print K[1]

I ran some tests, and it seems that the required list length converges to 2*n for large n, with a maximum of 3*n for n=1.

@Volatility Essentially, the maximum is 2n+1, which as you say has it's maximum at 3 for n=1 and (in a way) converges to 2n. This isn't too surprising since that's the maximum for the unpermuted sequence, and no step in the process can increase a number that's still ahead. I might add this to my answer.

I see you're already putting my .a extension to good work! There's a lot more goodies on the way, but isaac is sleeping right now: https://github.com/isaacg1/pyth/pull/32

@orlp, I actually happened to read the docs while writing the code (I usually use the doc.txt on GitHub for a manual) and saw the update. Fortunately, as I could've just skipped it and written a custom implementation...

Go 150
func f(j int){a:=make([]int,j*2);for i:=range a{a[i]=i};for i:=1;i<j;i++{b,c:=a[i],a[i+1];v:=b-c;if v<0{v*=-1};a[b+c],a[v]=a[v],a[b+c]};println(a[1])}

Ungolfed, nothing tricky, mostly stolen from @Pietu1998
func f(j int) {
    a := make([]int, j*2) // Build the array we will be working on
    for i := range a {
        a[i] = i
    }
    for i := 1; i < j; i++ {
        b, c := a[i], a[i+1]
        v := b - c
        if v < 0 {
            v *= -1
        }
        a[b+c], a[v] = a[v], a[b+c]
    }
    println(a[1])
}

http://play.golang.org/p/IWkT0c4Ev5

Java, 162
int f(int n){int a[]=new int[2*n],s,d,x,t;for(x=0;x<2*n;)a[x]=++x;for(x=0;++x<n;){s=a[x]+a[x-1]-1;d=Math.abs(a[x]-a[x-1])-1;t=a[s];a[s]=a[d];a[d]=t;}return a[0];}

Explanation
int f(int n) {
    int a[] = new int[2 * n], sum, diff, x, temp;
    for (x = 0; x < 2 * n;) {
        a[x] = ++x;  // set initial array
    }
    for (x = 0; ++x < n;) {
        sum = a[x] + a[x - 1] - 1;
        diff = Math.abs(a[x] - a[x - 1]) - 1;
        temp = a[sum];
        a[sum] = a[diff];
        a[diff] = temp;
    }
    return a[0];
}

You can save two bytes by moving the second loop body into the increment clause of the for statement. (Separate the statements with commata rather than semicola.)

dc, 134 132 131 bytes
[_1*]sOdsn2*ddslsSsa[ladd:S1-dsa0<P]dsPx1d0rsN:N[la1+dsad;SdS@r1+;SdS@rL@L@r+Ss-d0>Od;SrLsdSsrLs;Sr:S:S1;SladsN:Nlaln>G]dsGxln1-;Nf

Use echo $n $code | dc, where $n is n and $code is...the code (gasp). Quote to taste.
Edit: Unless you pester me for an explanation, I  will never get around to it.

Do I need to add three bytes for the  -e?

@Sir, it turns out you do not! [http://codegolf.stackexchange.com/questions/25670/output-pi-without-math#comment55713_25694]

Was that a conversation with yourself?

@NoOneIsHere: Yep, sure was. It was a question open to anyone, but I found the answer.

Perl 5, 131
A naive solution (i.e. a direct implementation of the definition). A subroutine, it takes input as a list of 1s of the desired length.
{map$a[$_]=$_,1..3*@_;($a[$a[$_-1]+$a[$_]],$a[abs($a[$_-1]-$a[$_])])=($a[abs($a[$_-1]-$a[$_])],$a[$a[$_-1]+$a[$_]])for 2..@_;$a[1]}

Visualize its output by e.g. print sub...->(1,1,1,1,1).
Explanation:
map$a[$_]=$_,1..3*@_ builds the array @a, indexing each integer by itself from 1 to 3 times the size of @_ (the input).
($a[$a[$_-1]+$a[$_]],$a[abs($a[$_-1]-$a[$_])])=($a[abs($a[$_-1]-$a[$_])],$a[$a[$_-1]+$a[$_]])for 2..@_ repeats the switcheroo repeatedly (one fewer times than the size of @_), switching $a[$a[$_-1]+$a[$_]] with $a[abs($a[$_-1]-$a[$_])] as $_ ranges from 2 to the size of @_.
And then the subroutine returns $a[1].

Perl 5, 90 + 1 (-p) = 91 bytes
@a=0..3*$_;$_=(map{@a[$d,$s]=@a[$s=$a[$_]+$a[$_-1],$d=abs$a[$_]-$a[$_-1]];$a[1]}1..$_)[-1]

Try it online!

source: Stack Exchange

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

sort: votes


text:
IPV4 subnet list cleaner (in CIDR notation)
We have a lot of IPV4 address, to group into subnets, so we need a tool for doing this:
Our list is very ugly, not ordered and sometime in subnet notation, sometime in simple address.
Sample:
192.168.5.16/30
192.168.5.18
192.168.2.231/27
192.173.17.0/24
192.168.1.5/32
192.168.5.18/32
192.168.3.0/24
192.168.2.231/27
192.168.2.245/29
192.168.4.0/29
192.173.16.0/24
192.173.18.0/24
192.173.19.0/24
10.100.12.24

some explanation about the input (our old list):

each line hold only 1 IPV4 subnet
if a line don't contain any subnet info like on line 2, it's a single ip, so the 32 bit mask is to be considered.
subnet info is in the CIDR form: IPV4/integer where integer is mask length
IPV4 is not necessarely the base (first in range) of subnet
list is not sorted
list is not short... could make more the 60k entries...
there is repetition, overlap of subnets... lot of useless lines

( The last is the main reason we need to build this tool! ;-)
From this sample list we want to obtain shortened, sorted and cleaned list like:
10.100.12.24/32
192.168.1.5/32
192.168.2.224/27
192.168.3.0/24
192.168.4.0/29
192.168.5.16/30
192.173.16.0/22

Where all lines is subnet and all IPV4 part is base IP (begin of range), sorted, and without overlap or repetitions.
And where all IP present somewhere in input is present and no one more!
CIDR
For informations about:

Subnetting http://en.wikipedia.org/wiki/IPv4_subnetting_reference
CIDR notation http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation

Code golf

Input values could be given as you will, (arguments, read from file or STDIN)
Output to STDOUT, one subnet per line.
Output has to be sorted by the unsigned integer value of IPV4 (big-endian)
Output has to contain as few lines as possible
Of course, sum of output subnet must match sum of input subnet! no more, nor less!  So 0.0.0.0/0 which override everything is not accepted! (unless it's the only valid answer, see last test)
Use of libraries forbiden! Standard loophole applies
Shortest code wins!

Test cases
For testing this, (under bash) I use something like:
for i in {167772416..167774464};do
     echo $[i>>24].$[i>>16&255].$[i>>8&255].$[i&255]
  done

as input, this must render:
10.0.1.0/24
10.0.2.0/23
10.0.4.0/22
10.0.8.0/24
10.0.9.0/32

or
for i in {167772416..167774464};do
     [ $i -gt 167773316 ] && [ $i -lt 167773556 ] ||
         echo $[i>>24].$[i>>16&255].$[i>>8&255].$[i&255]/30
  done

Note, I've added /30 after each ip. this will do a lot of overlap!
10.0.1.0/24
10.0.2.0/23
10.0.4.0/25
10.0.4.128/29
10.0.5.116/30
10.0.5.120/29
10.0.5.128/25
10.0.6.0/23
10.0.8.0/24
10.0.9.0/30

Extreme test rule
63.168.3.85/2
64.168.3.85/2
192.168.3.85/2
191.168.3.85/2

This special case must render:
0.0.0.0/0

Accepted answers
As this question seem not so easy, I will add time from question to the list

CJam, 101 - user23013 - 38 hours
Perl, 223 - nutki - 1 week
Pure bash, 1040 - F.Hauri - 4 days

What is the sort order?

@PeterTaylor It seems to be ordered byte-by-byte, in big-endian format. The subnets number can be ignored since if two subnets have the same IPv4 part, the larger contains the smaller, which can be ignored.

I'm confused about what the number after the / is doing, because at first sight it seems it can be safely ignored in the example. Is it possible for the first four numbers to be the same and the one after the /? Also only one out of 192.168.<16 through 19>.0/24  is shown. I assume that's because it's been masked off to 22 bits and simplified to 192.168.16.0/22 (there's no real explanation in the question about this.) But by that logic I can mask everything and  0.0.0.0/0 should be a  complete and valid output for all cases.

@steveverrill it's mask length: 32bits => 255.255.255.255, or 24bits => 255.255.255.0, 30bits => 255.255.255.252. And you're right: 192.168.1[6-9].0/24 => 192.168.16.0/22

@steveverrill You're right I missed this rule: no more!: 0.0.0.0/0 could not be accepted!

No answer? Not so easy?

I don't really understand your explanation of course, sum of output subnet must match sum of input subnet! no more, nor less! Maybe it's my lack of knowledge of IPV4, but is it valid (for example) to condense all the addresses starting 192.168 down to 192.168.0.0/16 ? And if not, why not? It's not clear to me from the rules why this hasn't been done in your example, yet it has been done for the addresses that you condensed into 192.173.16.0/22. Is there a minimum value for the mask length or something?

@steveverrill for sample: if 192.168.1.4 is not covered by the input list, theys must not match the output list! No more! For all IP betweeen 0.0.0.0 to 255.255.255.255 ( -> 4294967296 possibilities) no more must be found in ouptut than in input

Ok i get it now. 192.173.16.0/22 expands exactly to 192.173.[16-19].0/24 and as the output must be as brief as possible this is not only acceptable but also required.

When you say "Use of libraries forbidden", does that forbid core functions included in platform that may operate on IP addresses or external libraries?

Hem yes, I think, but if you post, comments from community will give better answer...

CJam, 101 95 94
qN/{'//('./1\+256b2b\{i)<}/}%_|{{):T;_aM+:M(a&}gT+}%${_2$#!{;}*}*]{_(!a32*+32<8/2fb'.*'/@,(N}%

The {~}2j construct didn't make it shorter...
Try it here. (And link for Firefox.)
Explanation
qN/               " Read each line. ";
{                 " For each line: ";
    '//           " Split by / ";
    ('./          " Split first item by . ";
    1\+256b2b     " The address + 2^32 in base 2, which always has length 33 ";
    \{i)<}/       " For each other items N (if any), get the first N+1 bits. ";
}%
_|                " Remove duplicates. ";
{                 " For each item (each array of bits): ";
    {             " Do: ";
        ):T;      " Remove last bit and save it in T. ";
        _aM+:M    " Add the array to M. ";
        (a#)      " Find the array in the original M. ";
    }g            " while it is found. ";
    T+            " Append the last T back. ";
}%
$                 " Sort. ";
{                 " Reduce and wrap in array: ";
    _2$#!         " Test if the previous string is a prefix of the current. ";
     {;}*         " If so, discard it. ";
}*]
{                 " For each item (each array of bits): ";
    _(!a32*+32<   " Remove first bit and pad to 32 bits to the right. ";
    8/2fb'.*      " Convert to IP address. ";
    '/@,(         " Append / and original length - 1. ";
    N             " Append a newline. ";
}%

Bravo, this seem work fine! (I've not asready test all special cases)

@F.Hauri It doesn't work with addresses like 0177.0x1, of course.

:->> This is not a test case! CIDR notation are four integer between 0 and 255, dot separated, terminated by a slash and another integer between 0 and 32.

test case: for i in {3232236343..3232237343};do echo $[i>>24].$[i>>16&255].$[i>>8&255].$[i&255];done

Give: 192.168.3.55/32 192.168.3.56/29 192.168.3.64/26 192.168.3.128/25 192.168.4.0/23 192.168.6.0/24 192.168.7.0/27 That's correct!!

Perl, 172 223 245
Using hashes was not necessary. The removal allowed for a significantly shorter code, though the idea is the same.
#!perl -lp0a
$_=join$\,sort map{1x(s/\d*./unpack B8,chr$&/ge>4?$&:32)&$_}@F;1while s/^(.*)
\1.*/$1/m||s/^(.*)0
\1.$/$1/m;s!^.*!(join'.',map{ord}split'',pack B32,$&).'/'.length$&!gme

Test me.
Older version with explanation:
#!perl -lp0a
s/(^|\.)(\d+)/sprintf"%08b",$2/ge,/\D/&&($_=$`|2x$',y/0-3/##01/)for@F;$_=join$\,sort@F;1while s/^((\d*)#*)
\2.*/$1/mg||s/^(\d*)0(#*)
\1[1]\b#*/$1#$2/mg;s!.+!$&.'/'.$&=~y/01//!ge;y/#/0/;s!\d{8}\B!$&.!g;s!\d{8}!"0b$&"!gee

Test me.
First convert input to textual format (s/(^|\.)(\d+)/sprintf"%08b",$2/ge,/\D/&&($_=$p|2x$',y/0-3/##01/)):
00##############################
01##############################
11##############################
10##############################

Sort it ($_=join$\,sort@F):
00##############################
01##############################
10##############################
11##############################

Clean using two regexps: one to remove duplicates and more specific addresses and the second to join two adjacent networks into one with a longer mask (s/^((\d*)#*)\n\2.*/$1/mg and s/^(\d*)0(#*)\n\1[1]\b#*/$1#$2/mg).
################################

And convert back to the original form (s!.+!$&.'/'.$&=~y/01//!ge;y/#/0/;s!\d{8}\B!$&.!g;s!\d{8}!"0b$&"!gee):
0.0.0.0/0

Yes! This work! I can't run this as a script. I have to run  perl -M5.0.0 script.pl <ip-list.txt but this work!

Ruby - 425
(broken - see comment below)
a=(0..32).map{[]}
l=->m{2**m-1<<32-m}
$<.map{|i|/\//=~i=i[?/]?i:i.chop+'/32'
s=$'.to_i
n=$`.split(?.).inject(0){|v,d|v*256+d.to_i}
next if s.times.any?{|t|a[t].any?{|e|n&l[t]==e[1]}}
s.upto(32){|t|a[t].reject!{|e|e[1]&l[s]==n}}
a[s]<<[i,n]
(b=k=n&l[s]
break if(y=a[s+1].select{|e|e[1]&l[s]==b}).size<2
a[s+1]-=y
a[s]<<[(0..3).map{k,i=k.divmod(256);i}.reverse*?.+?/+s.to_s,b])until(s-=1)<0}
puts a.flatten(1).sort_by{|v|v.pop}

Hmm, This seem bug at 1st test: ouput 192.168.2.192/26 instead of 192.168.2.224/27

@F.Hauri Hrm.  I'll look into it. Not  committed to fixing it yet though

Pure bash 1100 1079 1040
Edited: A little better more golfed!
#!/bin/bash -i
alias d=done e=unset f=printf\ -v g=local h=else i=then j=for k=while C=do E=fi
n(){ g s e i;j i in ${!u[@]};C [ $1 -ge $[i+1] ]&&[ $1 -le $[u[i]+1] ]&&s=$i
[ $2 -ge $[i-1] ]&&[ $2 -le $[u[i]-1] ]&&e=$i;d;if [ "$s" ];i if [ "$e" ];i \
[ $s -ne $e ]&&{ u[s]=${u[e]};e u[e];};h [ $1 -lt $s ]&&{ u[$1]=${u[s]};e u[s
];s=$1;};[ $2 -gt ${u[s]} ]&&u[s]=$2;E;h if [ "$e" ];i [ $1 -lt $e ]&&{ u[$1
]=${u[e]};e u[e];e=$1;};[ $2 -gt ${u[e]} ]&&u[e]=$2;h u[$1]=$2;E;E;};q(){
g s=${1#*/} m=${1%/*} z;[ -z "${s//*.*}" ]&&s=32;y $s z;set -- ${m//./ }
m=$[$1<<24|$2<<16|$3<<8|$4];n $[m&z] $[m|((2**32-1)^z)];};y(){ f $2 "%u" $[ (
2**32-1)^(~0^~0<<(32-$1))];};r(){ f $2 "%s" $[$1>>24].$[$1>>16&255].$[$1>>8&
255].$[$1&255];};t(){ g s z;k [ "$1" ];C s=32;k y $[s-1] z&&[ $1 = $[($1>>(33
-s))<<(33-s)] ]&&[ $2 -ge $[$1|((2**32-1)^z)] ];C ((s--));d;r $1 x;echo $x/$s
y $s z;if [ $2 -gt $[$1|((2**32-1)^z)] ];i set -- $[1+($1|((2**32-1)^z))] $2
h shift 2;E;d;};k read w;C q $w;d;p=-1;j o in ${!u[@]};C [ $o -gt $p ]&&p=${u[
o]}&&t $o ${u[o]};d

which work quickly, even on wide ranges!
./myscript.sh <<<"63.168.3.85/2\n64.168.3.85/2\n192.168.3.85/2\n191.168.3.85/2"
0.0.0.0/0

./myscript.sh < <(for i in {167772416..167774464};do
     [ $i -gt 167773316 ] && [ $i -lt 167773556 ] ||
         echo $[i>>24].$[i>>16&255].$[i>>8&255].$[i&255]/30
   done)
10.0.1.0/24
10.0.2.0/23
10.0.4.0/25
10.0.4.128/29
10.0.5.116/30
10.0.5.120/29
10.0.5.128/25
10.0.6.0/23
10.0.8.0/24
10.0.9.0/30

Javascript ~1335
While total js is 2009, the essential part is contained in two function and main routine. html, css and ~674 chars of javascript in only cosmetic.

var g={};function B(){document.getElementById('z').addEventListener('click',go);
window.addEventListener('resize',C);C();}function C(){document.getElementById('y'
).setAttribute('style','height:'+(window.innerHeight-46-document.getElementById(
'y').offsetTop).toFixed(0)+"px");document.getElementById('x').setAttribute(
'style','height:'+(window.innerHeight-46-document.getElementById('x').offsetTop
).toFixed(0)+"px");}function go(){document.getElementById('y').innerHTML='';
document.getElementById('A').innerHTML='...running...';w()
}function u(q,j){var o=Object.keys(g).sort(function(a,b){return a-b}),s,e;for(var
i=0;i<o.length;i++){if((q*1>=o[i]*1+1)&(q<=g[o[i]]*1+1))s=1*o[i];if((j*1>=o[i]-1
)&(j<=g[o[i]]-1))e=1*o[i]};if(typeof(s)!=='undefined'){if(typeof(e)!=='undefined'
){if(1*s<1*e){g[s]=g[e];delete g[e]}}else{if(1*q<1*s){g[q]=g[s];delete g[s];s=q};
if(1*j>1*g[s])g[s]=j}}else{if(typeof(e)!=='undefined'){if(1*q<1*e){g[q]=g[e];
delete g[e];e=q};if(1*j>1*g[e])g[e]=j}else{g[q]=j}}}function v(f,p){var e,ie,c=''
;while(typeof(f)!=='undefined'){e=32;while((ie=(~0<<(33-e))>>>0)&&(f==((f>>(33-e)
)<<(33-e))>>>0)&&(p>=(((~0<<32)^ie)|f)>>>0)&&(e>0))e--;c+=(f>>24&255)+"."+(f>>16&
255)+"."+(f>>8&255)+"."+(f&255);c+='/'+e+'
';ie=e>0?(~0<<(32-e))>>>0:0;if(p>(
(f|(~0<<32)^ie))>>>0){var d=f;f=1*1+((f|((~0<<32)^ie))>>>0)}else{f=undefined}}
return c}function w(){var l=[];g={};document.getElementById('A').innerHTML+=
'
reading...';var n=document.getElementById('x').value.split("\n");for(var
i=0;i<n.length;i++){if(!n[i].match("/"))n[i]+="/32";var s=n[i].match(
/(\d+)\.(\d+)\.(\d+)\.(\d+)\/(\d+)/);if((s)&&(s.length==6)){var k=(s[1]<<24|s[2]
<<16|s[3]<<8|s[4])>>>0;var e=(~0<<(32-s[5]))>>>0;var t=(~0&k&e)>>>0;var r=(((~0
<<32)^e)|t)>>>0;u(t,r);}};var o=Object.keys(g).sort(function(a,b){return a-b});
var h=-1;for(i=0;i<o.length;i++){if(1*o[i]>1*h){h=g[o[i]];document.getElementById
('y').innerHTML+=v(o[i],g[o[i]]);}}document.getElementById('A').innerHTML+=
'
printing...'};window.onload=B;
body{font-family:Sans;background:#9ac;}#z{position:absolute;top:3em;right:2%;}
span button, span input{font-size:.63em;}#A{width:50%;min-height:3.4em;background:
#679;border:1px solid black;border-color:white black black white;border-radius:
.5em;padding:.2em 1em .2em 1em;margin:1em 0px .1em 0px;margin-left:24%;color:
#cdf;box-shadow: 2px 2px 4px black;}#y{width:72%;overflow:auto;margin-left:24%;
background:#bce;padding:1em;border-radius:.8em;border:1px solid black;box-shadow:
2px 2px 4px;border-color:white black black white;}#x{position:fixed;top:1.5em;
left:1%;padding:1em;width:18%;anchor:left;height:33em;border-radius:.3em;border:
1px solid black;border-color:white black black white;box-shadow:2px 2px 4px;}
<button id="z"> GO </button><textarea id="x"></textarea>
---

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


text:
Express all 16 boolean functions with the less than operator
There are 16 distinct boolean functions for two binary variables, A and B:
A B | F0 | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | F13 | F14 | F15
-----------------------------------------------------------------------------------------
0 0 | 0  | 0  | 0  | 0  | 0  | 0  | 0  | 0  | 1  | 1  | 1   | 1   | 1   | 1   | 1   | 1
0 1 | 0  | 0  | 0  | 0  | 1  | 1  | 1  | 1  | 0  | 0  | 0   | 0   | 1   | 1   | 1   | 1
1 0 | 0  | 0  | 1  | 1  | 0  | 0  | 1  | 1  | 0  | 0  | 1   | 1   | 0   | 0   | 1   | 1
1 1 | 0  | 1  | 0  | 1  | 0  | 1  | 0  | 1  | 0  | 1  | 0   | 1   | 0   | 1   | 0   | 1

The less than operator <, which normally isn't thought of as a logic operator like NOT, AND, or OR, is in fact one of these functions (F4) when applied to boolean values:
A B | A < B
-----------
0 0 | 0
0 1 | 1
1 0 | 0
1 1 | 0

Interestingly, we can simulate any of the 15 other functions using expressions that only contain the symbols ()<AB10. These expressions are read and evaluated just as they would be in many standard programming languages, e.g. parentheses must match and < must have arguments on either side of it.
Specifically, these expressions must comply with the following grammar (given in Backus-Naur form):
element ::= A | B | 1 | 0
expression ::= element<element | (expression)<element | element<(expression) | (expression)<(expression)

This means that useless paretheses and expressions of the form A<B<1 are not allowed.
So the expression A<B matches the function F4, and A<B<1 must be changed to (A<B)<1 or A<(B<1).
To prove that all of the 15 other functions can be turned into expressions, it suffices to form a set of expressions that is functionally complete, because then, by definition, they can be composed into expressions for any function.
One such set of expressions is x<1 (where x is A or B), which is ¬x, and (((B<A)<1)<A)<1, which is A → B. Negation (¬) and implication (→) are known to be functionally complete.
Challenge
Using the characters ()<AB10, write 16 expressions in the form described above that are equivalent to each of the 16 distinct boolean functions.
The goal is to make each of the expressions as short as possible. Your score is the sum of the number of characters in each of your 16 expressions. The lowest score wins. Tiebreaker goes to the earliest answer (provided they didn't edit their answer later with shorter expressions taken from someone else).
You do not technically need to write any real code for this contest but if you did write any programs to help you generate the expressions, you are highly encouraged to post them.
You can use this Stack Snippet to check if your expressions do what's expected:

function check() {
  var input = document.getElementById('input').value.split('\n'), output = ''
  if (input.length == 1 && input[0].length == 0)
    input = []

  for (var i = 0; i < 16; i++) {
    var expected = [(i & 8) >> 3, (i & 4) >> 2, (i & 2) >> 1, i & 1]

    output += 'F' + i.toString() + '\nA B | expected | actual\n-----------------------\n'
    for (var j = 0; j < 4; j++) {
      var A = (j & 2) >> 1, B = j & 1, actual = '?'
      if (i < input.length) {
        try {
          actual = eval(input[i]) ? 1 : 0
        } catch (e) {}
      }

      output += A.toString() + ' ' + B.toString() +
        ' | ' + expected[j] + '        | ' + actual.toString() + '     '
      if (expected[j] != actual)
        output += ' <- MISMATCH'
      if (j != 3)
        output += '\n'
    }
    if (i != 15)
      output += '\n\n'
  }
  document.getElementById('output').value = output
}
<textarea id='input' rows='16' cols='64' placeholder='put all 16 expressions here in order, one per line...'></textarea>

<button type='button' onclick='check()'>Check</button>

<textarea id='output' rows='16' cols='64' placeholder='results...'></textarea>

"?" means there was some sort of error

-1, problem is too simple.

Well I guess there's no point posting another answer, so here's my attempt.

@isaacg You're right. I'd say it's far from the simplest PPCG contest ever but the fact that optimal answers will be almost exactly identical makes it kind of boring as a competition. However, I do think it serves perfectly fine as a personal exercise, especially for people who aren't experts in logic. I'm sure at least half the people on PPCG are here for fun, not just to win, or else no one would ever answer a question with a non-winning submission.

I'd probably compare this to the controversial golf practice. This was a fun and interesting question, if a bit easy.

If anyone's interested, here's 3 variables. The longest expressions correspond to (0, 0, 0, 1, 0, 1, 1, 0) and (0, 1, 1, 0, 1, 0, 0, 0).

I'm not even sure this is metagolf, since this doesn't really ask for a program that golfs the results. It's more like a normal code golf which is so specific that someone could use a program to do the work for them (which in theory is possible for any code golf, although very hard in practice).

@MartinBüttner Yeah, I wasn't quite sure what to tag it.

Forgive my pedantry, but I fixed the BNF into actual BNF, including the restriction that A<B<0 is not allowed. This should make it easier for people to make language generators as well.

Just an observation: As is evident from the posted entries, the material implication "If A then B" may be achieved by a shorter phrase than the one you gave.  Actually by a sub-phrase of the one you gave--therefore I'm guessing that you knew this form but deliberately obfuscated/lengthened it for the purpose of the challenge.

100 characters
0
(A<1)<B
B<A
A
A<B
B
((B<A)<((A<B)<1))<1
(A<(B<1))<1
A<(B<1)
(B<A)<((A<B)<1)
B<1
(A<B)<1
A<1
(B<A)<1
((A<1)<B)<1
1

There are a few options for some of these, so this 100-char set isn't identical to the previously posted ones.
0
(B<A)<A
B<A
A
A<B
B
((A<B)<((B<A)<1))<1
(A<(B<1))<1
A<(B<1)
(A<B)<((B<A)<1)
B<1
(A<B)<1
A<1
(B<A)<1
((B<A)<A)<1
1

An easier proof that < is functionally complete would be that A<(B<1) gives NOR.
The code which I used to find this is a heavy simplification of some Boolean optimisation code I've used on earlier challenges, with two small changes:

Make the score of an expression be the length of its string rather than the number of operations.
Make the string avoid unnecessary parentheses, to minimise the length.

import java.util.*;

public class PPCG48193 {

    public static void main(String[] args) {
        Expr[] optimal = new Expr[16];
        int unfound = 16;

        PriorityQueue<Expr> q = new PriorityQueue<Expr>();
        q.offer(new Expr(0, "0"));
        q.offer(new Expr(15, "1"));
        q.offer(new Expr(3, "A"));
        q.offer(new Expr(5, "B"));
        while (unfound > 0) {
            Expr e = q.poll();
            if (optimal[e.val] != null) continue;

            optimal[e.val] = e;
            unfound--;
            for (Expr e2 : optimal) {
                if (e2 != null) {
                    Expr e3 = e.op(e2), e4 = e2.op(e);
                    if (optimal[e3.val] == null) q.offer(e3);
                    if (optimal[e4.val] == null) q.offer(e4);
                }
            }
        }

        for (Expr e : optimal) System.out.println(e.expr);
    }

    private static class Expr implements Comparable<Expr> {
        public final int val;
        public String expr;

        public Expr(int val, String expr) {
            this.val = val;
            this.expr = expr;
        }

        public Expr op(Expr e) {
            String l = expr.contains("<") ? String.format("(%s)", expr) : expr;
            String r = e.expr.contains("<") ? String.format("(%s)", e.expr) : e.expr;
            return new Expr((15 - val) & e.val, String.format("%s<%s", l, r));
        }

        public int compareTo(Expr e) {
            int cmp = expr.length() - e.expr.length();
            if (cmp == 0) cmp = val - e.val;
            return cmp;
        }
    }
}

What's the total character count?

@immibis, 100 chars, same as the others.

"avoid unnecessary parentheses, to minimise the length" no you don't avoid them so that you would shorten but to comply with the rules.

@EriktheOutgolfer, I'm not 100% sure what you mean, but my best guess is that you're referring to "This means that useless paretheses and expressions of the form A<B<1 are not allowed." If so, check the timestamps: that was an edit made after this answer.

100 characters
0
(A<B)<B
B<A
A
A<B
B
((A<B)<((B<A)<1))<1
(B<(A<1))<1
B<(A<1)
(A<B)<((B<A)<1)
B<1
(A<B)<1
A<1
(B<A)<1
((A<B)<B)<1
1

100 characters
0
(A<1)<B
B<A
A
A<B
B
((A<B)<((B<A)<1))<1
((B<1)<A)<1
(B<1)<A
(A<B)<((B<A)<1)
B<1
(A<B)<1
A<1
(B<A)<1
((A<1)<B)<1
1

Hey, it's not exactly the same as the other ones. I spent like 10 minutes on this so it's worth posting anyways, even if this is 2 years old.

100 characters
0
(A<1)<B
B<A
A
A<B
B
((A<B)<((B<A)<1))<1
(A<(B<1))<1
A<(B<1)
(A<B)<((B<A)<1)
B<1
(A<B)<1
A<1
(B<A)<1
((B<1)<A)<1
1


text:
Computing truncated digits sums of powers of pi
Given a positive integer n output the sum of the first n decimal digits of the fractional part of πn.
Example input and outputs:

1 →     1
     2 →    14
     3 →     6
     4 →    13
     5 →    24
    50 →   211
   500 →  2305
  5000 → 22852

Built-in functions computing digits of π or evaluating either power series or continued fractions are not allowed. Standard loopholes apply. Input/output can be in a convenient format (stdin, stdout, function in/output, etc).
Shortest code in bytes wins.

Are other trig functions that could be used to calculate pi, but not necessarily directly, like arctangent or imaginary logarithms also banned? Also, is there an upper limit to n that it can fail after?

@FryAmTheEggman If those trig functions can compute arbitrary digits of pi, then yes they're banned. Your program should work in theory for any n, but it's forgiven if either runtime or memory becomes too high.

Pyth, 33
s<>j^u+/*GHhyHy^TyQr*TQ0ZQT_y*QQQ

Based on this answer by isaacg. Could probably be golfed more. Slow.
s<>j            Digit sum of...
  ^
    u               Evaluate pi = 2 + 1/3*(2 + 2/5*(2 + 3/7*(2 + 4/9*(2 + ...))))
      +
        /
          *GH
          hyH
        y^TyQ       Except we generate a large integer containing 2n digits,
                    rather than a fraction.
      r*TQ0         Experimentally verified that 10*n iterations will give enough
                    precision for 2n digits (# digits correct grows faster than 2n).
      Z
    Q               To the nth power.
  T_y*QQQ         Get the last 2n^2 digits (all the fractional digits) and get the
                  first n fractional digits.

This answer really needs at least sufficient explanation to justify that it computes enough digits to get the right answer.

@PeterTaylor I'll add an explanation tomorrow, just about to go to bed.

Each iteration produces one correct bit (see Appendix A). 2n digits should require ~6.64n iterations.

Python - 191 Bytes
t=i=1L;k=n=input();f=2000*20**n;A=range(n+1)
for k in range(2,n):A=[(A[j-1]+A[j+1])*j>>1for j in range(n-k+1)];f*=k
while k:k=(1-~i*n%4)*f/A[1]/i**n;t+=k;i+=2
print sum(map(int,`t`[-n-4:-4]))

~4x faster version - 206 bytes
t=i=1L;k=n=input();f=2000*20**n;A=[0,1]+[0]*n
for k in range(1,n):
 f*=k
 for j in range(-~n/2-k+1):A[j]=j*A[j-1]+A[j+1]*(j+2-n%2)
while k:k=(1-~i*n%4)*f/A[1]/i**n;t+=k;i+=2
print sum(map(int,`t`[-n-4:-4]))

Input is taken from stdin. Output for n = 5000 takes approximately 14s with the second script (or 60s with the first).

Sample usage:
$ echo 1 | python pi-trunc.py
1

$ echo 2 | python pi-trunc.py
14

$ echo 3 | python pi-trunc.py
6

$ echo 4 | python pi-trunc.py
13

$ echo 5 | python pi-trunc.py
24

$ echo 50 | python pi-trunc.py
211

$ echo 500 | python pi-trunc.py
2305

$ echo 5000 | python pi-trunc.py
22852

The formula used is the following:

where An is the nth Alternating Number, which can be formally defined as the number of alternating permutations on a set of size n (see also: A000111). Alternatively, the sequence can be defined as the composition of the Tangent Numbers and Secant Numbers (A2n = Sn, A2n+1 = Tn), more on that later.
The small correction factor cn rapidly converges to 1 as n becomes large, and is given by:

For n = 1, this amounts to evaluating the Leibniz Series. Approximating π as 10½, the number of terms required can be calculated as:

which converges (rounded up) to 17, although smaller values of n require considerably more.
For the calculation of An there are several algorithms, and even an explicit formula, but all of them are quadratic by n. I originally coded an implementation of Seidel's Algorithm, but it turns to be too slow to be practical. Each iteration requires an additional term to be stored, and the terms increase in magnitude very rapidly (the "wrong" kind of O(n2)).
The first script uses an implementation of an algorithm originally given by Knuth and Buckholtz:

Let T1,k = 1 for all k = 1..n
Subsequent values of T are given by the recurrence relation:
Tn+1,k = 1/2 [ (k - 1) Tn,k-1 + (k + 1) Tn,k+1 ]
An is then given by Tn,1
(see also: A185414)

Although not explicitly stated, this algorithm calculates both the Tangent Numbers and the Secant Numbers simultaneously. The second script uses a variation of this algorithm by Brent and Zimmermann, which calculates either T or S, depending on the parity of n. The improvement is quadratic by n/2, hence the ~4x speed improvement.

Excellent explanation of the maths behind your answer.

Python 2, 246 bytes
I have taken a similar approach to my answer at Calculate π with quadratic convergence . The last line takes the Nth power of pi and sums the digits. The N=5000 test takes a minute or so.
from decimal import*
d=Decimal
N=input()
getcontext().prec=2*N
j=d(1)
h=d(2)
f=h*h
g=j/h
a=j
b=j/h.sqrt()
t=j/f
p=j
for i in bin(N)[2:]:e=a;a,b=(a+b)/h,(a*b).sqrt();c=e-a;t-=c*c*p;p+=p
k=a+b
l=k*k/f/t
print sum(map(int,`l**N`.split('.')[1][:N]))

Some tests:
$ echo 1 | python soln.py
1
$ echo 3 | python soln.py
6
$ echo 5 | python soln.py
24
$ echo 500 | python soln.py
2305
$ echo 5000 | python soln.py
22852

The ungolfed code:
from decimal import *
d = Decimal

N = input()
getcontext().prec = 2 * N

# constants:
one = d(1)
two = d(2)
four = two*two
half = one/two

# initialise:
a = one
b = one / two.sqrt()
t = one / four
p = one

for i in bin(N)[2:] :
    temp = a;
    a, b = (a+b)/two, (a*b).sqrt();
    pterm = temp-a;
    t -= pterm*pterm * p;
    p += p

ab = a+b
pi = ab*ab / four / t
print sum(map(int, `pi ** N`.split('.')[1][:N]))

Line 8, you can turn a=j and p=j to a=p=j iirc. Maybe.

Thanks. There are more golfing optimisations for this code, but it will not be competitive without a rewrite using an algorithm without Decimal.


text:
Shortest Sorted Hello World
Write a program that takes no input and prints Hello, World! to stdout or your language's closest alternative. The catch is that each line in your program must only contain printable ASCII characters and it must be in lexicographical order, a.k.a. sorted.
Here are all 95 printable ASCII characters in order:
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

So, for example, the line !!A0~ would be invalid because the A and 0 are out of order. The line !!0A~ would be valid.
Each line in your program may be any length and there may be any number of lines. Empty lines are considered sorted. Each of the newlines in your program must be the same (no mixing \n and \r\n). Tabs and other non-printable ASCII characters are forbidden.
Due to popular demand, the win condition has been switched around:
The submission with the fewest lines wins. Tiebreaker goes to the shortest program (newlines count as single characters).
Only Hello, World! and an optional trailing newline should be output. Note that HQ9+ is invalid since it outputs hello, world. I may forbid languages similar to HQ9+ that have one character "Hello, World!" commands due to their triviality.
Hint:

 This is definitely possible in Unary and Lenguage, though not very concisely.

It's a bit late now, but somehow I feel like least lines then fewest bytes might have been more interesting...

@Sp3000 We'd need a combined measure, or else Unary and Lenguage would mean that only 1-liners could compete.

@Sp3000 Maybe, I just wanted to make sure Unary/Lenguage weren't likely to win. I'm open to changing it though (sorry isaacg). Upvote Sp's comment if you agree.

@Sp3000 I've taken your advice. See updates.

Can the order be inversed? For example, reading from left-to-right?

@IsmaelMiguel No

@Calvin'sHobbies That made things dificult for me, but I managed it!

Can you please define "or your language's closest alternative"? Does this mean if a language has a specific and different string it generally prints to show its functionality, we can do that instead?

@mbomb007 The alternative is in place of stdout, not Hello, World!. Some languages don't really have a standard output stream (e.g. for Javascript I'd accept alert or console.log).

Neither of those are sorted though.

@mbomb007 I know, I was just giving a general example of an stdout alternative.

This can be used for testing if your code lines are truly correctly sorted: http://ideone.com/knuIEL

Trust me, Unary isn't going to win, because of Headsecks.

Why are "Hello World!" questions so popular, when many more important questions are unsolved

Headsecks, 1 line, 366 bytes
                                                                        $(((((((((((((((((((((((((((((,000000044888<AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADIIIIIIIIIIIILPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPTXXXXXXXXXXXXXXXXXXXXXXXX\```diiiiiilqqqqqqqqtyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy|

Headsecks is a trivial Brainfuck substitution where the only thing that matters is the code point modulo 8. The equivalent Brainfuck is merely
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++.+++++++..+++.-------------------------------------------------------------------.------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++++++++++.+++.------.--------.-------------------------------------------------------------------.

Luckily this naive approach just fits. There's some potential for golfing down bytes, but it might be hard.
Tested using this Python interpreter.

Generating code
code = "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++.+++++++..+++.-------------------------------------------------------------------.------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++++++++++.+++.------.--------.-------------------------------------------------------------------."
command_map = "+-<>.,[]"

last_point = 32
out = []

for char in code:
    curr_mod = command_map.index(char)
    last_mod = last_point % 8

    if curr_mod > last_mod:
        last_point += curr_mod - last_mod

    elif curr_mod < last_mod:
        last_point += (8 - last_mod) + curr_mod

    out.append(chr(last_point))

print("".join(out))

That was clever! +1

Could you use a shorter BF program, or is the program built a specific way for a reason? I tried my the BF program I used in your generator, but the output included some unicode.

@mbomb007 The problem with shorter BF programs is that even this naive method ends at code point 124, so I don't think there's enough wiggle room to introduce new chars...

///, 7 lines, 22 bytes
/
//Hello
,
 Wor
l
d
!

A rare chance for /// to be competitive (well as long as no one starts with Unary and Lenguage...).
The code first encounters a /, and parses the
/
//

as a substitution instruction which removes all newlines from the remainder of the program. Afterwards, the program merely reads
Hello, World!

which is printed verbatim as it doesn't contain any further slashes.

I didn't even realize that URLs could contain that many slashes in a row.

@AlexA. It took months to get that URL working, IIRC. We had to keep renaming the article to deal with changes to the server configuration and MediaWiki configuration.

JavaScript (67 66 62 lines, 227 269 bytes)
(Note: only tested on Firefox 36 and Safari 8, contains minor ES6 features (the Set class))
Z
=
!""+
(0[[]]
+
(
!!""+Set
));c
=Z[~
-22]
$=Z[
3]
$$=Z[
15]
$$$=Z[
24]
$$$$=Z[
1]
$$$$$=Z[
0]
Set
[c
+
$$$+Z[
5]
+Z[
16]
+
$$$$$+
$$$$+Z[
2]
+c
+
$$$$$+
$$$+
$$$$]
(Z[
14]
+
$$+
$+
$$$$+
$$$$$+
"(\
'H\
"+
$+
$$+
$$+
$$$+
",\
 W\
"+
$$$+
$$$$+
$$+Z[
6]
+
"\
!')\
")
()

The code above basically does:
alert("Hello, World!")

Obviously alert is not sorted. So instead we need to generate the statement as a string, and "eval" it:
s = "alert('Hello, World!')";   // generate this using sorted code
eval(s)

How to generate the string? ES5 supports line continuation so that
"AL\
ERT" === "ALERT"

But the character code \ appears before all lowercase letters, so we have to generate the lowercase letters using other methods.
We borrow some idea of JSFuck here. The lowercase letters involved in the alert statements are:
t e r a o l d

all of these can be extracted from characters of standard objects, which may be expressed in terms of some sorted sequence:
t, e, r ← true      = !""
a, l    ← false     = !!""
o       ← function  = Set
d       ← undefined = 0[[]]

How do we evaluate the string? Surely we cannot use eval(s) as it is not sorted. Alternatively we could use Function(s)(), but we cannot use Function as it is not sorted either. However, Function is the constructor of all functions, which means Set.constructor === Function.
Adding the identifier constructor makes the list of lowercase letters become:
t e r a o l d c u n s

which fortunately could still be generated by "truefalseundefinedfunction":
t, e, r, u ← true      = !""
a, l, s    ← false     = !!""
o, c, n    ← function  = Set
d          ← undefined = 0[[]]

After prettifying, the code above should read like:
// lines 1~8 defines our string containing all lowercase letters we want
Z = true + (undefined + (false + Set))
// Z = "trueundefinedfalsefunction Set() { [native code] }"

// lines 8~20 defines the variables `c`, `$` (e), `$$` (l), `$$$` (o),
// `$$$$` (r), `$$$$$` (t)
// for the corresponding lowercase letters extracted from `Z`

// the rest calls:
Set["constructor"]("alert('Hello, World')")()
// lines 22~36 generates the "constructor" string
// lines 37~61 generates the "alert('Hello, World')" string

Update: Renamed E, L, O, R, T to various repetition of $ to reduce 4 lines.

Absolutely brilliant! I sure don't know if this is possible to use the same time of strategy in Python (it's case sensitive).

Very nice! Note that =Z[3*7] can be written as =Z[~-22] which only needs one line break instead of two.

@mbomb007 Yeah, but spaces are and they're first in the ASCII set...

@meandmycat Thanks! Updated.

Insomnia, 4 lines, 59 bytes
 FFFFGjnnnnooty
FLLddeejkopqyyyyy~~
(<ddjnoppppqrtu
<<Fddfj

This program is generated by optimizing for line count.
10 lines, 43 bytes
(u
pt
(dppty
p~
j
<Fptt{
(otz
?o
FLu
<?FFu~

This above program is generated by optimizing for byte count.

Cygwin bash, 16 lines, 60 bytes
This only works due to the case-insensitive file name on Windows, and the fact that Cygwin look up the utilities case-insensitively even if you don't set it to recognize path case-insensitively.
A\
=Hello
A\
+=\
",
"Wor
A\
+=l
A\
+=d
A\
+=\
!
E\
CHO\
 $A

Take note of that ECHO at the end.

I'm not sure if this is 17 or 16 lines (there is a new line at the very end), but either way, this is not going to win anything.

You won 10 upvotes, that's a lot already. The most upvoted ones (as of now) have 12 upvotes! And the /// solution with 23 upvotes.

><>, 6 lines, 111 bytes
  """""""/;;Hello
        &\o
      &++\oooo~~
"++++++++\bbbdlr
    +++++\ccccccccfooo}
    $++66\cfffffooooopr

I'm having trouble golfing out an extra line, but in any case I'm happy to have beaten the 7-line method.
Explanation
><> is a stack-based 2D language where instructions are single chars and program flow can be up, down, left or right. The " instruction toggles string parsing, pushing chars until a closing " is met, but because of the nature of ><> there's no such thing as "multi-line string parsing" like with CJam's strings or Python's triple quoted strings. This turned out to be a major problem because starting and ending a line with a " and having other chars in between (e.g. "some chars") is not allowed!
Note that / and \ reflect program flow, so we actually execute the first line then all of the lines in reverse order, and most lines are actually executed backwards!
[Line 1]

""""""              Three empty strings, push nothing
"/;;Hello  "        Push "/;;Hello  ". Note the wrapping - ><> is toroidal!
""""""              Three empty strings, push nothing

[Line 6]
66++$               Turn the top " " into "," by adding 12, then swap top two
rp                  Reverse stack and pop top 3
ooooo               Print "Hello", stack is now " ,"
fffffc              Push some 15s and a 12

[Line 5]
+++++               Sum the 15s and 12 to give 87, or "W"
}ooo                Move "W" to the back and output ", W"
fcccccccc           Push a 15 and some 12s

[Line 4]
++++++++            Sum the 15 and 12s to give 111, or "o"
"rldbbb\++++++++"   Push chars to stack
r                   Reverse stack
ld                  Push length of stack and 13, not used
bbb                 Push three 11s

[Line 3]
++&                 Sum the 11s to give 33, or "!" and put in register
~~                  Pop top two
oooo                Print "orld"

[Line 2]
&                   Put "!" from register to stack
o                   Print "!"

[Line 1]
;                   Terminate

On a side note, here's an amusing attempt at a ><> least bytes (23 lines, 47 bytes):
v
"
!
d
l
r
o
W

,
o
l
l
e
H
"
/<
l
?
!
;
o
\^

In the second code you can save 2 bytes thanks to vertical wrap-around: http://pastebin.com/heqCr1vJ

CJam, 5 4 lines, 162 bytes
"Hello
")))))))))))))))))))))))))))))))))))68S\cel
"Wor
")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))@SX\c|

Same number of lines as Insomnia! (but a lot more bytes)
Try it online.
Explanation
"Hello\n"        Push "Hello" and a newline
)                Uncons the newline
)))...)))        Increment the newline into a ","
68S\             Push 68 and a space then swap, leaving 68 on top
c                Convert 68 into a char "D"
el               Lowercase "D" into "d"
"Wor\n"          Push "Wor" and a newline
)                Uncons the newline
)))...)))        Increment the newline into an "l"
@                Rotate top three elements, moving the "d" to the top
SX\              Push a space and 1 then swap, leaving the space on top
c                Convert the space (which is an array) into a char
|                Bitwise or the space (32) with 1 to give "!" (33)

CJam automatically prints the stack afterwards.
Thanks to @Optimizer for reminding me that Sc works, because otherwise SX| fails (it does a setwise or instead, giving the array consisting of a space and 1).

><> (Fish), 5 lines, many bytes
The code is extremely long, when I say [6535529689086686142930090 '+' signs] and [6535529689086686142930090 'd' characters] in the first line of the code, I mean that there are literally 6535529689086686142930090 plus signs in a row!
(And for the following lines add the necessary prefix spaces.)
'[6535529689086686142930090 '+' signs]^`[6535529689086686142930090 'd' characters]
                                   **,/288
                                     -/:o
                             %**288:;?\
                                   (1:\

A shorter testable alternative which only prints Hi:
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++^`hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
                                                                                **,/288
                                                                                -/:o
                                                                                %**288:;?\
                                                                                (1:\

Method:

In the first line we create a huge number representing the string in base128.
In the rest of the lines (going from bottom to top) we print the following character in every loop until the value of the integer reaches 0.
The looping code is :1(?;:882**%:o-288**,.

(We can print arbitrary 2+ chars long string with this method.)

Not a valid solution; 6535529689086686142930090 is not ordered.

@theonlygusti "The code is extremely long, interpret [6535529689086686142930090 '+' signs] and [6535529689086686142930090 'd' characters] literally in the first line of the code." (If unclear what I mean by that check the second piece of code.)

Oh, okay! Sorry, silly me :P I took it literally.

Size is 13 YB, roughly 1000 times the size of the Internet.

@Charles I get ~40YB including the latter lines.

@Veedrac You don't know what a "YB" is, do you. Yottabyte

@Yottabyte I don't know what Veedrac of March 31, 2015 was thinking, but he obviously wasn't thinking straight.

PHP (7 / 17 lines, 36 / 59 bytes):
Due to the amount of invalid answer, I rewrote this answer.
The browser version? Gone.
But I have 2 solutions, both based on bitwise xor (^) of strings in PHP.
This is an extremely powerful solution! Sometimes, it allows to save plenty of bytes.
First, the shortest answer:
Echo
Hello
,AM^mm
,Wor
,OOO^
"#+n
";

I know, it looks awful, but it works!
The next one depends on newlines.
Yes, it uses newlines (\n/UNIX style is required)!
Echo
Bo
.ff
.e
.
"&*]ex
fn
"^
"\n
\n
\n
\n
\n
\n
\n
",B^c
;

The newlines on this one are required to work.
It isn't perfect, but works!

Both answers were based on @MartinBüttner's solution:
Echo
Hello
.
chr
(44
).
chr
(29
+3
).Wor
.l
.d
."!
";

A special thank to @n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳, @CJDennis, @MartinBüttner and @skagedal for detecting all my mistakes and for their suggestions.

@n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ Thank you a lot for that. I totally forgot to check a 8th time. I've fixed it now.

@MartinBüttner I call that bizarre, since browsers usually remove the newlines.

The output in the browser is Hello , Wor l d !. Note the extra spaces! This is not a valid answer, unfortunately.

@CJDennis Can you tell me the browser you used?

Tested in Firefox 36, IE 8, Opera 12.17 & Opera 28 (Chromium) on Windows XP. All rendered the output identically. Since any number of whitespace characters are rendered as a single space character (barring no break space, etc.) each newline gets converted to a space. I would be interested to know if any browser renders your output without spaces!

@CJDennis I've fixed it now. It's a monster, but works as expected. I'll call it frankencode (after Frankenstein).

@MartinBüttner I may sound like a stubborn child, but there is nothing saying that the output can't be the rendered output. Also, I make it explicit that it only works in a web-browser. And the rendered output matches exactly what is required. I really appreciata a lot your solution and I will add it as an alternative answer ans suggestion with the due credit.

@MartinBüttner I've reduced your code. If you want to update the pastebin, feel free to do so.

Nice abuse of the language! Since the errors it generates technically go to stderr and not stdout, your code is now valid even though in my case I see a lot of errors in my browser! And, incredibly nit-picky, my PHP setup has short tags off so the first line on my computer is <?php which is invalid! However, I'll forgive you for this! OK, just tested <?Php which works, so I've just learnt that the start tag is case-insensitive!

You can save 5 characters and one line in your browser version by removing the
 as the newline is optional.

@CJDennis I can put there the 'long' tags if you wish. Or I can go crazy and use the  tag (Yes, it works too!). But I'm happy with the result. Actually, I could drop the echo entirelly, if instead of <=>? the order had the ? between < and =. Also, I can't drop the
. If I leave the
 out, the browser will render a space at the end, instead of a new line. According to the rules, that is invalid. The errors generated are because the constants Hello, Wor, l and d don't exist and PHP is warning that it is assuming them as a string.

The top two solutions in this answer do not follow the rules. The top one has, as line 8, ."!<br - this is not sorted. The second one has as line 10: ."! - not sorted.

@skagedal It is indeed badly sorted... I'm trying to find a fix for it and I'm preparing an update, 'cause this answer is getting a mess with so many edits.

@skagedal I've rewritten the whole answer and it is clean now. I'm sorry for the delay.

@IsmaelMiguel I'm sorry, but no. Line 7 of the first suggestion is not sorted. Lines 5 and 7 of the second suggestion are not sorted.

@skagedal Thanks for pointing out. Now they are fixed. But I'm not happy with the fix. I'll look for a better one.

@skagedal Now they are correct. I've managed to reduce 2 lines from the first answer. The last one will be harder, but it was also just meant as an alternative. The idea was to use as many newlines as possible. But once again, thanks for pointing that out. It was a bit late when I made the edit, so, I kinda expected to mess up somewhere.

@IsmaelMiguel The first solution now has correctly sorted lines! :) Line 6 of the second still doesn't work.

@skagedal You are correct once again. The fix was easy: Just swapped quotes! Since the order is "#$%&, this now is correct.

@IsmaelMiguel Good job! :)

@skagedal Thank you. Sadly, I only saw your python code 20 minutes ago. Kinda late on the run, but surelly helped me to check once again if I had screwed again or if everything was well ordered.

Pyth, 7 lines, 23 bytes
-
"Hello
,
 Wor
l
d
!"b

Pretty simple, just use a multiline string and remove the newlines.
Try it here.

@orlp I added multiline strings a few days ago, and Pyth has had support for newlines in the input for ages. This doesn't use multiline mode at all. Try it on the online compiler, which definitely has no multiline mode.

Its almost the same in CJam, with same byte count too.

Forth, 41 lines, 143 bytes
Try it online.
I'm very proud of this. I whipped it out pretty quickly once I found I could do it, having Google searched for case-insensitive languages, and I already know Forth decently. It can almost definitely be shortened, both bytes and lines. Suggestions are appreciated. :D
This program essentially pushes the decimal value of each ASCII character, then prints each one. I attempted to optimize while I wrote it, hence it is less readable than I'd like.
33
99
1
+
DUp
8
+
2DUp
6
+
SWap
11
+
2OVer
SWap
8
9
*
EMit
1
+
EMit
DUp
DUp
EMit
EMit
3
+
EMit
29
3
2DUp
+
EMit
*
EMit
EMit
EMit
EMit
EMit
EMit

The Emit lines don't work, as i (105) is less than m (109).

It should be "EMit", then?

Marbelous, 9 lines, 94 bytes
3333
    @ADD
    358C
++--29\\
++--3555DE
<<<<<<>>~~
+++++446666D
++++++++../\
      ++------

Test it online here. Using spaces for blank cells must be checked.
Visual representation of source:

Explanation: Each hexadecimal value in this program moves downward every "tick" (unless it is on \\, in which case it moves to the right). ++ will increment the value, -- decrement, ~~ apply a bitwise not, etc. Values that fall of the bottom are printed as an ASCII character.
For example: The 33 in the top corner becomes (((0x33 +1 +1) << 1) +1 +1 = 0x6C (l).

Batch - 39 Lines (202 bytes)
I wanted to cut down on the size by enabling delayed expansion by running the code inside of a cmd call using the /v on switch, but could not get past all the carats.
@S^
ET^
LO^
C^
AL^
 EN^
ABL^
E^
DEL^
AY^
E^
DEX^
P^
ANS^
IO^
N
@S^
ET^
 0=Hello
@S^
ET^
 1=^
,^
 Wor
@S^
ET^
 2=l
@S^
ET^
 3=d
@E^
CHO^
 !^
0^
!!1^
!!2^
!!3^
!^^^
!

Without the newlines (and carats to escape newlines):
@SETLOCAL ENABLEDELAYEDEXPANSION
@SET 0=Hello
@SET 1=, Wor
@SET 2=l
@SET 3=d
@ECHO !0!!1!!2!!3!^^!

Rebol - 15 lines (51 bytes)
PRin
AJOin
[
'Hello
Sp
+
12
Sp
'Wor
'l
'd
Sp
+
1
]

Words in Rebol are case-insensitive (eg. PRINT, Print and print would all call the same function).
The above code tidied up:
prin ajoin [
    'Hello  sp + 12  sp  'Wor  'l  'd  sp + 1
]

NB. sp returns the space char!

Your program is invalid, the { can't be before any letters.

@theonlygusti - Fixed (gone from 9 lines to 13).   The only line that caused me a problem was {,}.   This is now Sp + 12 (over 3 lines) which is equivalent of space character + 12 (ie. comma)

Perl, 17 lines
$_
=
'pr
int
"Hello
,
 Wor
l
d
!"';s
!
!!g
;s
!.
*
!$&
!eex

Unary, 1 line, lots of bytes
Every character in this program is 0. The source is too long to put in here, but it consists of a string of this many zeros:
327380789025192647555922325233404088310881092761595127419003295178342329930050528932118548

This is the decimal representation for this binary number:
0b1010010010010010010010010110000010010010010110000010010000010010010000010010010000010001001001001011111000010000010000011110001111001011111000000100000011011011100010010010010010010010100100010010010100000000100001011100001100010010010100011011011011011011100011011011011011011011011100000000010100

Which was created from this BrainF*** program:
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>-[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.

See how I generated it: http://ideone.com/lMT40p

Vyxal, 9 lines, 25 bytes
`
Hello
,
 Wor
l
d
!`
\
-

Try it Online!
`        #
Hello    |
,        |
 Wor     | Push 'Hello\n,\n Wor\nl\nd\n!'
l        |
d        |
!`       #
     \   # Push '\n'
      -  # Remove all '\n' from 'Hello\n,\n Wor\nl\nd\n!'
         # Implicit output

Ruby, 19 lines, 95 bytes
$;=
$>
$;<<
:Hello
$;<<
44::chr
$.=
33::
-1
$;<<
$.::chr
$;<<
:Wor
$;<<
:l
$;<<
:d
$;<<
33::chr

Possibly the second-hardest code restriction for Ruby I've seen on this site, after the monstrosity here.
Edit for explanation: The only Ruby output method that's sorted is the << method on STDOUT. Unfortunately, the constant for STDOUT is $>, and > is higher ASCII than most symbols, so it's not really possible to call a method on it. We need a multi-line assignment statement to get it into a more tractable variable name, $; (semicolon is still pretty high, but most variables of this form are either non-assignable, or can only be strings).
Symbols (:Wor, etc. ) are the easiest way to do a literal, and I don't see a way to strip newlines from a string, so I need multiple print statements. The space and punctuation can't go into a symbol literal, but luckily the chr method on numbers is legal, so I can get a character from its ASCII value. :: is an alternate way of calling methods. Space is tricky because I can't write 32, so I subtract 1 from 33 and assign it to a variable.

Retina, 12 lines, 29 bytes (non-competing)
The language is newer than the challenge.

Hello
$
,
$
 Wor
$
l
$
d
$
!
Try it online

authors: n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

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