text:
Spherical excess of a triangle
Spherical excess of a triangle
As we all know, the sum of angles of any planar triangle is equal to 180 degrees.
However, for a spherical triangle, the sum of angles is always greater than 180 degrees. The difference between the sum of the spherical triangle angles and 180 degrees is called spherical excess . The task is to compute the spherical excess of a triangle with given vertex coordinates.
Some background
A spherical triangle is a part of the sphere defined by three great circles of the sphere.
Both sides and angles of spherical triangle are measured in the term of angle measure, because each side can be considered as a intersection of the sphere and some planar angle with vertex at the center of the sphere:

Each three distinct  great circles define 8 triangles, but we only take proper triangles into consideration, ie. triangles whose angle and side measures satisfy

It's convenient to define vertices of a triangle in terms of geographic coordinate system. To compute the length of an arc of sphere given the longitude λ and latitude Φ of its ends we can use formula:

, where

or more explicitely:

(source: https://en.wikipedia.org/wiki/Haversine_formula)
The two basic formulas that can be used to solve a spherical triangle are:

the law of cosines:

the law of sines:

(source: https://en.wikipedia.org/wiki/Spherical_trigonometry#Cosine_rules_and_sine_rules)
Given three sides, it's easy to compute the angles using the cosine rule:

Finally, the spherical excess of a triangle is defined:

What's interesting about the relation between the spherical excess of a triangle and its area:

So on a unit sphere, the excess of a triangle is equal to area of that triangle!
The task
Write a function or a program that will compute spherical excess of a triangle in degrees given the triangle vertices coordinates.
The vertex coordinates are provided in terms of geographic coordinate system.
Each vertex should be passed in form [latitude in degrees][N|S][longitude in degrees][E|W]. Longitude and E or W can be skipped when latitude is 90 ie. 90N, 90S, 10N100E, 30S20W are proper vertex descriptions, while 80N or 55S are not.
The latitudes and longitudes are always integer in the test cases.
The answers with error less than one degree will be accepted (as in examples below). The result can be rendered as both real or integer therefore, up to your convenience.
Examples
Input
90N0E
0N0E
0N90E

Output
89.999989

Input
90N
0N0E
0N90E

Output
89.999989

Input
0N0E
0N179E
90N0E

Output
178.998863

Input
10N10E
70N20W
70N40E

Output
11.969793

In all test cases longitude and latitude are integer numbers.
Parsing the vertex coordinates is the part of the task, so a vertex must be passed as single string/literal , it's not allowed to pass 80N20E as four parameters/strings: 80, N, 20, E.
This is guaranteed that vertices are all distinct and neither two of the three vertices make an antipodal points pair.
Scoring
This is code-golf, so the shortest code wins.

The correct outputs for the first few test cases are 90 degrees and 179 degrees. I get that you are saying that they don't have to be spot on, but how many decimal places of accuracy are required?

@steveverrill Updated the task. Accuracy of one degree is enough.

@pawel.boczarski Are latitudes/longitudes always integers?

@flawr Yes, I updated the task.

Matlab, 288 266 bytes
Here the commented version that should explain what is going on:
                                  %parsing the input
for k=1:3;
    s=input('','s');              %request input
    if sum(s>57)<2;               %if we have only one letter, add arbitrary second coordinate
        s=[s,'0E'];
    end;
    S=1-2*(s(s>57)>80);           %calculate the sign of the coordinates
    s(s>57)=44;                   %replace letters with comma
    L(k,:)=eval(['[',s,']']).*S;  %evaluates string as list and multiply with signs
end;
i=[2,3,1];
                                  %calculate the angular distance between each pair of points
a=arrayfun(@distance,L(:,1),L(:,2),L(i,1),L(i,2))*pi/180;
                                  %evaluate the spherical excess
f=@(a,b,c)sum(acos((cos(a)-cos(b).*cos(c))./(sin(b).*sin(c))))-pi;
disp(f(a,a(i),a([3,1,2]))*180/pi)

Fully golfed (linebreaks can be removed):
for k=1:3;s=input('','s');if sum(s>57)<2;s=[s,'0E'];end;
s(s>57)=44;L(k,:)=eval([91,s,93]).*(1-2*(s(s<48)>80));end;
i=[2,3,1];p=pi/180;a=arrayfun(@distance,L(:,1),L(:,2),L(i,1),L(i,2))*p;
b=a(i);disp((sum(acos((cos(a([3,1,2]))-cos(b).*cos(a))./(sin(b).*sin(a))))-pi)/p)

Ruby, Rev 3 264 255 bytes
Major changes:
New constant r = 180/PI defined and used throughout function. e had to be initialized to +PI, so excess now counts downwards and is negated before returning.
t[] eliminated: Ruby allows the data that was assigned to t[] to be directly assigned to u,v,w.
Single i loop to do the job of two, ?: ternary operator switches between tasks.
Many other minor changes.
include Math
->s{r=180/e=PI
x=y=z=n=[]
9.times{|i|i<6?(u,v,w=eval(?[+s[i%3].gsub(/[NE]/,"/r,").gsub(/[SW]/,"/-r,")+"0]")
i%2<1&&x=y=z=1
n[i/2]=(z*=sin(u))+(y*=cos(v)*w=cos(u))+x*=w*sin(v)):e-=acos((n[i-7]-(c=n[i-6])*d=n[i-8])/sqrt((1-c*c)*(1-d*d)))}
-e*r}

Ruby, Rev 1 283 277 bytes
Requires an array of 3 strings.
include Math
->s{x=y=z=n=[]
6.times{|i|t=eval(?[+s[i%3].gsub(/[NE]/,k="*PI/180,").gsub(/[SW]/,"*-1"+k)+"0]")
i%2<1&&x=y=z=1
n[i/2]=(z*=sin(u=t[0]))+(y*=cos(u)*cos(v=t[1]))+(x*=cos(u)*sin(v))}
e=-PI
3.times{|i|e+=acos((n[i-1]-n[i]*d=n[i-2])/sqrt((1-n[i]**2)*(1-d**2)))}
e/PI*180}

Overview
The lengths of the triangle sides on the unit sphere are equal to the angles between the vectors describing the two points. But we don't need to know that angle. It suffices to know the cosine of the angle, which is easily obtained from cartesian coordinates using the Dot Product.
Explanation
The input strings are converted into a string representation of an array, which is then evaluated and stored in t, as below. The final zero is not needed if two coordinates are given. If only latitude 90 is given, the zero is interpreted as the longitude.
Example:  70N20W --> [70*PI/180,20*-1*PI/180,0]

The Dot Products are of the form a.b=ax*bx+ay*by+az*bz. As the vectors are all of unit length, the dot product is equal to the cosine of the angle between the vectors.
In order to calculate them a loop is iterated 6 times passing twice through the input data. On even iterations 0,2,4 the variables x,y,z are set to 1 to start a new calculation. On each iteration these variables are multiplied by the x,y and z components of each vector, using the longitude and latitude data stored in t[0],t[1] (which for golfing reasons is also assigned to u,v). The sum of the variables is written to array n (the garbage values on even iterations being overwritten by the correct values on odd iterations) so that at the end n contains the 3 dot products [a.b, c.a, b.c].
For the cosine rule, we need the cosines of the three included angles between vertices, but we also need the sines. These are obtained as sqrt(1-cosine**2). As the sines are multiplied together the expression can be rearranged so that only one call to sqrt is required. The fact that we do not know if the sine was positive or negative does not matter, as the haversine formula always gives the positive sine anyway. The important physical quantity is the distance between the points, which is absolute and therefore always positive.
For each iteration i=0..2, we calculate the value for the angle opposite array element i-1 using the other elements i and i-2. Negative array subscripts like this are legal in Ruby, they just wrap around to the beginning of the array.
Ungolfed in test program
Requires three sets of coordinates on the same line, with spaces between them.
include Math
g=->s{
  n=[]         #array for dot products
  x=y=z=1      #it's required to use these variables once before the loop, for some bizarre reason
  6.times{|i|
    t=eval(?[+s[i%3].gsub(/[NE]/,k="*PI/180,").gsub(/[SW]/,"*-1"+k)+"0]")
    i%2<1&&x=y=z=1
    n[i/2]=(z*=sin(u=t[0]))+(y*=cos(u)*cos(v=t[1]))+(x*=cos(u)*sin(v))
  }

  e=-PI        #set e to -PI and begin accumulating angles
  3.times{|i|
    e+=acos((n[i-1]-n[i]*n[i-2])/sqrt((1-n[i]**2)*(1-n[i-2]**2)))
  }

e/PI*180}      #return value

puts g[gets.split]

source: Stack Exchange

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

sort: votes


text:
Get The Getters
The Task
I guess everybody loves automatic code generation and saving some time during work. You have to create a lot of classes and members during the day and you don't want to create all those getters manually.
The task is to write a program or function, that generates getters for all class members automatically for you.

The Input
In our language objects are very simple. Names of classes and members must start with an chararacter from [a-zA-Z] and can only contain the characters [a-zA-Z0-9]. Here's an example:
class Stack {
    public overflow;
    protected trace;
    private errorReport;
}

The Output
This is a valid output based on the given example:
class Stack {
    public overflow;
    protected trace;
    private errorReport;

    public function getOverflow() {
        return this->overflow;
    }

    public function getTrace() {
        return this->trace;
    }

    public function getErrorReport() {
        return this->errorReport;
    }
}

The Getter
The requirements for a getter method are:

The function name must start with get followed by the member name with an uppercase initial.
The function has no parameters.
To return a variable use return this->memberName;.
getters and setters (see The Bonuses) must be grouped and must come after all variable declarations.

Example:
private value1;
private value2;

public function getValue1() { return this->value; }
public function setValue1(value) { this->value = value; }

public function getValue2() { return this->value; }
public function setValue2(value) { this->value = value; }

The Requirements

Create a program or a function.
Input can come from STDIN, command line arguments, function arguments, a file etc.
Any output format is acceptable from a simple return-value to a file or writing to STDOUT.
In- and output don't need to be formatted with whitespaces, newlines, tabs etc. This is a valid input: class A{protected a;}.
You can assume that the input is valid and your program can handle unexpected input unexpected as well.

The Bonuses
You can get down to 10% of your original byte count by withdrawing 30% for each feature:
A: Your program can address newly added variables and adds missing getters only (public function getB() { return this->b; } in this case):
class A {
    public a;
    public b;

    public function getA() { return this->a; }
}

B: Your program also generates setters:
class A {
    public a;
    public getA() { return this->a; }
    public setA(a) { this->a = a; }
}

C: Your program can handle static members:
class A {
    public static c;
    public static function getC() { return this->c; }
}

This is code golf – so shortest answer in bytes wins. Standard loopholes are disallowed.

This is my first question - a not too hard one. Hope you like it. Thanks to Martin Büttner for helpful tips in the Sandbox.

Will there only be one class per input?

If the input has no newlines, should the output have any?

@CᴏɴᴏʀO'Bʀɪᴇɴ Yes, there will be only one class per input.

@kirbyfan64sos Newlines are optional. The output can be pretty or minified.

When supporting both bonuses A and B should items that have getters, but no setters, have setters in the output?

@FryAmTheEggman That's a very good question. I would say that for bonus B you can assume that the input is complete, so if there's a getter there's also a setter.

Do the setters always have to take a variable of that name? For instance, would it be valid to generate public function setOverflow(x){this->overflow=x;}?

@kirbyfan64sos Yes that would be valid, as it doesn't break functionality.

In which language are you allowed to refer to this in a static accessor?

@Neil Good catch - I thought nobody would notice. I saw my mistake  after I posted it and there was already one answer. So I didn't want to change the requirements afterwards. It's a very special language. ;)

Perl, 161 - 90% = 16.1 bytes
$/=0;$_=<>;for$g(/\bp\S*( +static)? +(\S*);/g){++$i%2?$c="public$g function":/get\u$g/||s/}$/$c get\u$g(){return this->$g;}\n$c set\u$g(x){this->$g=x;}\n}/}print

You beat the Pyth answer o_o kudos!

Pyth, 198 bytes - 90% = 19.8 bytes 187 - 90% = 18.7 bytes 183 bytes - 90% = 18.3 bytes
pJ<rs.z6_1sm?}+=b"get"K+rh=Zed1tZJks[Y=N|@d1kGbK"(){return "=H+"this->"Z";}"YNG"set"K"(x){"H"=x;}"):Js["(?:(?:"=Y"public""|private|protected)(?!"=G" function "")( static)?) (\w+)")4\}

Must...beat...Perl...
187-byte/18.7-byte version
J<rs.z6_1s_+\},sm?}+=b"get"K+rh=Zed1tZJks[Y=N|@d1kGbK"(){return "=H+"this->"Z";}"YNG"set"K"(x){"H"=x;}"):Js["(?:(?:"=Y"public""|private|protected)(?!"=G" function "")( static)?) (\w+)")4J

198-byte/19.8-byte version
J<rs.z6_1s_,sm?}K+rhed1tedJks["public"=N|@d1k=G" function ""get"K"(){return this->"ed";}public"NG"set"K"("ed"){this->"ed"="ed";}"):J"(?:(?:public|private|protected)(?! function )( static)?) (\w+)"4J

TODO: More golfing!

+1 for Must beat pearl...

JavaScript ES6 (at the moment), 305 289 223 - 60% = 89.2 bytes
Was 256 - 30% = 179.2 bytes
Qualifies for static and setter bonuses; now with extra ES6!
s=>s.replace(/\}$/,s.match(/(public|private)( static)* \w+/g).map(e=>{o=(r=e.split` `).pop();return(n=r.join` `)+` get${U=o[0].toUpperCase()+o.slice(1)}(){return this->${o};}${n} set${U}(${o}){this->${o}=${o};}`}).join``+"}")

ES5 function, 115.6 bytes
function g(s){return s.replace(/\}$/,s.match(/(p(?:ublic|rivate))( static)* (\w+?);/gm).map(function(e){o=(r=e.split(" ")).pop().replace(/;/,"");return(n=r.join(" "))+" get"+(U=o[0].toUpperCase()+o.slice(1))+"(){return this->"+o+";}"+n+" set"+U+"("+o+"){this->"+o+"="+o+";}"}).join("")+"}")}

I think o.slice(1,o.length)) can simply be shortened to o.slice(1)), and I think you can inline v, since you only use it once (i.e., start your function with return s.replace(/\}$/, s.match(...).map...). Also, I don't believe you need a space between return and (.

@apsillers  Good point. I was going to do the second suggestion, but I simply had no time. Thanks for your golfs! ^_^

I think you can save 2 bytes just having public|private in your regex!

CJam, 71 bytes
q';/W<_{S%W=:O(eu"public function get"\@"{return this->"O";}"}%\';f+\'}

Try it online in the CJam interpreter.

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


text:
Three mutual quines
The task
In this challenge, your task is to write three programs that form a kind of mutual quine-like system.
Let's call the programs A, B and C.
If one of the programs is given the source of another program as input, it shall output the source of the third program.
For example, if A is given B as input, it outputs C.
If the programs are given their own source as input, they shall output the three strings "three", "mutual", and "quines" (without quotes).
In all cases, they may output one additional trailing newline.
For any other inputs, the programs may do anything, including crash.
Example
For example, suppose that the source codes of A, B and C are aSdf, ghJk and zxcV.
Then the programs should behave as follows.
Source Input  Output
--------------------
aSdf   aSdf   three
aSdf   ghJk   zxcV
aSdf   zxcV   ghJk
ghJk   aSdf   zxcV
ghJk   ghJk   mutual
ghJk   zxcV   aSdf
zxcV   aSdf   ghJk
zxcV   ghJk   aSdf
zxcV   zxcV   quines

Rules and scoring
The solutions A, B and C can be either functions or full programs, but they must be completely independent: no shared code is allowed.
Standard loopholes and quine rules apply, so the programs can't access their own source codes in any way.
Your score is the combined byte count of A, B and C, lower score being better.

What exactly means "no shared code is allowed"? Can't they have similar parts? (This would make answering in Java difficult, as most programs have a public static void main part somewhere.) Or just that you can't write a function which is called by all three?

@PaŭloEbermann It means the latter: each of the 3 programs should be functional on its own.

CJam, 165 147 114 108 99 bytes
2 _ri^_q+@"quinesmutualthree"6/=?

1 _ri^_q+@"quinesmutualthree"6/=?

3 _ri^_q+@"quinesmutualthree"6/=?

Thanks to @MartinBüttner for a suggestion that helped save 48 bytes!
Try it online in the CJam interpreter.
Verification
$ cat A
2 _ri^_q+@"quinesmutualthree"6/=?
$ cat B
1 _ri^_q+@"quinesmutualthree"6/=?
$ cat C
3 _ri^_q+@"quinesmutualthree"6/=?
$

$ cjam A < A
three
$ cjam A < B
3 _ri^_q+@"quinesmutualthree"6/=?
$ cjam A < C
1 _ri^_q+@"quinesmutualthree"6/=?
$

$ cjam B < A
3 _ri^_q+@"quinesmutualthree"6/=?
$ cjam B < B
mutual
$ cjam B < C
2 _ri^_q+@"quinesmutualthree"6/=?
$

$ cjam C < A
1 _ri^_q+@"quinesmutualthree"6/=?
$ cjam C < B
2 _ri^_q+@"quinesmutualthree"6/=?
$ cjam C < C
quines

Idea
The set {0, 1, 2, 3} is a group under the operation ^ (binary exclusive OR), where each element is its own inverse.
If all three programs are identical except for the the first character (an element of {0, 1, 2, 3}), we can distinguish and print them easily:

We start by XORing the digit at the beginning of the source code and the input.
If the result is in 0, source and input match.
Thus, we print one of the three words, selected by this common digit.
If the result is not 0, it is the element of {1, 2, 3} that is neither in the source nor in the input.
Thus, we prints it, followed by the rest of the input.

How it works
2                                  e# Push the number N on the stack.
  _                                e# Push a copy.
    r                              e# Read a token from STDIN, i.e., the input up
                                   e# to and excluding the next whitespace char.
     i                             e# Cast to integer.
      ^                            e# XOR it with the copy of N. Result: X
       _                           e# Push a copy of the result.
        q+                         e# Append the rest of the input.
          @                        e# Rotate N on top of the stack.
           "quinesmutualthree"6/   e# Push ["quines" "mutual" "three"].
                                =  e# Select the word at index N.
                                 ? e# If X is non-zero, select the modified input;
                                   e# otherwise, select the word.

Wow, i read the question and thought "no-one's going to come up with an answer for that." Then I looked down and saw an answer from Dennis (who else?) +1!


text:
Code Billiards (Levenshtein golf)
You must use one language to write programs that perform the following nine tasks, in any order you want.

Convert an inputted number from base 10 to base 36.

Sample input: 1000
Sample output: RS (output must be upper case)

Convert each character in a string to its base 10 decimal ASCII codes and print the codes concatenated together.

Sample input: Scrambled 3GG5
Sample output: 839911497109981081011002051717153

Determine if an inputted number is divisible by 1738.

Return a truthy value if it is and a falsy value if it isn't.

Determine if a string has the letter q in it.

Return a truthy value if it does and a falsy value if it doesn't.

Encode an inputted string of letters with a Caesar cipher of +1.

Case must be preserved. Non-letter characters will be printed without modification.
Sample input: Good morning, World!
Sample output: Hppe npsojoh, Xpsme!

Find and print the sum of the prime factors of a number.

Sample input: 1320
Sample output: 21

Print PPCG.
Print the first n positive integers that are divisible by floor(sqrt(n)).

n is an inputted integer.

Replace every o and O in an inputted string with ಠ.

Sample input: Onomatopoeia
Sample output: ಠnಠmatಠpಠeia

You will have noticed that this challenge is Code Billiards, not Code Golf. The objective of this challenge, like in billiards, is to set up your code so it can be modified only slightly for the next challenge. This is why your programs do not have to solve the above tasks in order.
Your score  is determined as follows

Your score goes up by 1 each byte in your programs.
Your score goes up by floor(n^(1.5)) if two consecutive programs have a Levenshtein distance of n. For example if your first program is potato and your second program is taters, your score goes up by 12 for 12 bytes and by 11=floor(5^(1.5)) for a Levenshtein distance of 5.

The objective of this challenge is to have as low a score as possible after all nine programs have been written. Standard CG rules apply.

To see the leaderboard, click "Show code snippet", scroll to the bottom and click "► Run code snippet". Snippet made by Optimizer.

/* Configuration */

var QUESTION_ID = 63675; // Obtain this from the url
// It will be like http://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 43444; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "http://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "http://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    else console.log(body);
  });

  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    lang = jQuery(''+lang+'').text();

    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body { text-align: left !important}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}

<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

Whoa... I literally had the EXACT same idea for a challenge last night. How weird...

@ETHproductions I got the idea last night as well, and wrote something about it on the Sandbox. Did your idea come from there? If not, the coincidence is really funny.

No, I had the idea as I was on my way to bed. Didn't see your post at all! I guess this is an example of "code-golf minds think alike" ;)

What's the Levenshtein-distance of ಠ and a? Is it 1 (counting ಠ as 1 char) or 2 (because ಠ is actually 2 bytes)?

What's the Caesar-Chiphre of "zZ"?. Is it "aA" or "Aa"?

@Jakube Aa. Capitalization is held constant. Since it is a substitution, the distance is 1.

So which is it? Aa has the inverse capitalization of zZ.

@Mego Well, it's kind of slow.

@Mego Here's a faster algorithm. :) Also, you may not have seen this, but in my answer is a snippet that automatically arranges the programs in the optimal order, and it uses the super-fast algorithm, too.

Japt, 886 866 766 725 688 669
Tasks 5 and 6 are killers. Perhaps there are shorter ways to get them done. I think the Levenshtein distances could still be reduced as well.

Task 3 (divisiblity): !(U%#ۊ
7 bytes (arabic char messes up alignment)
Task 4 ('q' check): U!=Uk'q 7 bytes, dist 11
Task 1 (base conversion): Us36 u 6 bytes, dist 14
Task 2 (ASCII codes): UmX=>Xc 7 bytes, dist 14
Task 7 (see for yourself): "PPCG" 6 bytes, dist 18
Task 9 (ಠ replacement): Ur"[Oo]",'ಠ 13 bytes, dist 27
Task 8 (floor(sqrt(n))): X=Uq f;XoU*X+1,X 16 bytes, dist 52
Task 6 (prime factor sum): 2oU fX=>2oX eY=>X%Y &&!(U%X)r(X,Y =>X+Y 39 bytes, dist 172
Task 5 (Caesar cipher): UmX=>128o mY=>Yd)a k'A i#Z,'A k'a i#z,'a gXc 44 bytes, dist 216

Here's a snippet that will tell you (one of) the most efficient ways to arrange your programs:

function L(s,t) {
  if(s == t) return 0;
  if(s.length === 0) return t.length;
  if(t.length === 0) return s.length;

  var v0 = Array(t.length+1),
      v1 = Array(t.length+1);

  for(var i=0; i<v0.length; i++) v0[i]=i;
  for(i=0; i<s.length; i++) {
    v1[0]=i+1;
    for(var j=0; j<t.length; j++)
      v1[j+1] = Math.min(v1[j]+1, v0[j+1]+1, v0[j]+(s[i]==t[j]?0:1));
    for(j=0; j<v0.length; j++) v0[j]=v1[j];
  }
  return v1[t.length];
}

function run(x) {
  R.innerHTML='';
  var b={}, k=0, min=1/0, item='';
  for(var i in x) {
    for(var j in x.slice(+i+1)) {
      k=b[i+(+i+(+j)+1)]=b[(+i+(+j)+1)+i]=L(x[+i],x[+i+(+j)+1]);
      if(k<min) min=k, item=i+(+i+(+j)+1);
    }
  }
  var order=item, q=10;
  while(order.length < x.length && q--) {
    min=1/0, item='';
    for(i in b) {
      if(b[i]<min) {
        if(i[0]==order.slice(-1) && order.indexOf(i[1])==-1)
          min = b[i], item = i[1];
      }
    }
    order+=item;
  }
  var score=0,y=0;
  function getByteCount(s){return(new Blob([s],{encoding:"UTF-8",type:"text/plain;charset=UTF-8"})).size}
  console.log("Task",(+order[0]+1)+":",y=getByteCount(x[order[0]])),score+=y
  for(i in order.slice(1))
    console.log(" ",y=Math.pow(b[order[i]+order[+i+1]],1.5)|0),score+=y,
    console.log("Task",(+order[+i+1]+1)+":",y=getByteCount(x[order[+i+1]])),score+=y;
  console.log("Total:",score)
}

console.log = function(){R.innerHTML+=Array.prototype.slice.call(arguments).join(' ');R.innerHTML+='
'};

Input programs here, one per line:

<textarea id=O rows="9" style="width:90%"></textarea>

<button onclick="run(O.value.split('\n'))">Run</button>

With the latest version of Japt (non-competing in this challenge), most tasks get shorter:

Task 1: s36 u 5 bytes
Task 2: mc 2 bytes
Task 3: v#ۊ
4 bytes
Task 4: oq 2 bytes
Task 5: ;B±B+C²UrF,@Bg1+BbX 19 bytes
Task 6: k â x 5 bytes
Task 7: "PPCG 5 bytes
Task 8: B=U¬f)oU*B+1B 13 bytes
Task 9: ro'ಠ'i 6 bytes

The optimal order is now 2,4,3,1,6,7,9,8,5, coming in at a whopping score of 217, less than one-third of the original!
Suggestions welcome!

Pyth, score 489
Base conversion: 15
s@L+s`MTrG1jQ36

Caesar Cipher: 13 + 11^1.5
u.rGHrBG1z 36

Divisible by 1738: 7 + 11^1.5
!%Q1738

First N positive integers: 8 + 8^1.5
*Rs@Q2SQ

Sum of prime factors: 4 + 6^1.5
s{PQ

Appearance of q in string: 4 + 4^1.5
}\qz

Join all ASCII codes: 5 + 4^1.5
jkCMz

Print "PPCG": 5 + 5^1.5
"PPCG

Replace with ಠ: 9 + 7^1.5
Xz"oO"\ಠ

Ruby, 1488
Probably a lot of room for improvement here. Spent most of the time calculating the score...
Sum of prime factors: 64

require'prime';p gets.to_i.prime_division.reduce(0){|s,a|s+a[0]}

Base 36:  30 + 471.5 = 352

puts gets.to_i.to_s(36).upcase

Divisible by 1738: 22 + 151.5 = 80

puts gets.to_i%1738==0

Print PPCG: 9 + 181.5 = 85

puts:PPCG

Does string contain q?: 10 + 81.5 = 32

p gets[?q]

Replace o: 23 + 161.5 = 87

puts gets.gsub(/o/i,?ಠ)

Ceasar cipher: 32 + 211.5 = 128

puts gets.tr 'A-Za-z','B-ZAb-za'

ASCII codes: 37 + 261.5 = 169

puts gets.chomp.chars.map(&:ord).join

Integers divisible by square root: 72 + 561.5 = 491

puts *(1..1/0.0).lazy.select{|i|i%Math.sqrt(i).floor==0}.take(gets.to_i)

You might get an improvement if you converted your programs to lambdas

Java, score 8331
Them levenshtein distances are killing my score here.
(These programs take input as command line arguments)
Program 1 (119):
class L{public static void main(String[]a){System.out.print(Integer.toString(Integer.parseInt(a[0]),36).toUpperCase());}}

Program 2 (120+561.5=539):
class L{public static void main(String[]a){/*System.out.print*/for(char b:a[0].toCharArray())System.out.print((int)b);}}

Program 3 (101+491.5=444):
class L{public static void main(String[]a){System.out.print/*for*/(Integer.parseInt(a[0])%1738==0);}}

Program 4 (108+201.5=197):
class L{public static void main(String[]a){System.out.print(/*forInteger.parseInt(*/a[0].indexOf('q')>=0);}}

Program 5 (186+1071.5=1293):
class L{public static void main(String[]a){for(char b:a[0].toCharArray())System.out.print(Character.isLetter(b)?Character.isUpperCase(b)?b>'Y'?'A':(char)(b+1):b>'y'?'a':(char)(b+1):b);}}

Program 6 (327+2281.5=3747):
class L{public static void main(String[]a){int i,k=0,j=i=Integer.parseInt(a[0]);for(;i>0;i--)if(p(i)&&j%i==0)k+=i;System.out.print(k);}static boolean p(int n){if(n<2)return 0>0;if(n==2||n==3)return 1>0;if(n%2==0||n%3==0)return 0>0;int i,k=(int)Math.sqrt(n)+1;for(i=6;i<=k;i+=6)if(n%(i-1)==0||n%(i+1)==0)return 0>0;return 1>0;}}

Program 7 (336+101.5=368)
class L{public static void main(String[]a){/*int i,k=0,j=i=Integer.parseInt(a[0]);for(;i>0;i--)if(p(i)&&j%i==0)k+=i;*/System.out.print("PPCG");}static boolean p(int n){if(n<2)return 0>0;if(n==2||n==3)return 1>0;if(n%2==0||n%3==0)return 0>0;int i,k=(int)Math.sqrt(n)+1;for(i=6;i<=k;i+=6)if(n%(i-1)==0||n%(i+1)==0)return 0>0;return 1>0;}}

Program 8 (351+341.5=549):
class L{public static void main(String[]a){int i,k=1,j=(int)Math.sqrt(i=Integer.parseInt(a[0]));for(;k<i;k++)/*if(p(i)&&j%i==0)k+=i;*/System.out.println(j*k);}static boolean p(int n){if(n<2)return 0>0;if(n==2||n==3)return 1>0;if(n%2==0||n%3==0)return 0>0;int i,k=(int)Math.sqrt(n)+1;for(i=6;i<=k;i+=6)if(n%(i-1)==0||n%(i+1)==0)return 0>0;return 1>0;}}

Program 9 (305+841.5=1075):
class L{public static void main(String[]a){int i,k=1,j=0;System.out.print(a[0].replaceAll("o|O",""+(char)3232));}static boolean p(int n){if(n<2)return 0>0;if(n==2||n==3)return 1>0;if(n%2==0||n%3==0)return 0>0;int i,k=(int)Math.sqrt(n)+1;for(i=6;i<=k;i+=6)if(n%(i-1)==0||n%(i+1)==0)return 0>0;return 1>0;}}

It's Java. You shouldn't expect a short score... ;)

interface l{static void main(String...

Pyth, score 817
number 1: 24
Jjk+UTrG1VjKvz36=+k@JN;k

number 2: (9 + 161.5 = 73)
Vz=+kCN;k

number 3: (5 + 81.5 = 27)
/QC"ۊ

number 4: (5 + 141.5 = 57)
hxz\q

number 5: (39 + 371.5 = 264)
J+GrG1VzIhxJNKChCNIhxJKpK)EpC-CK26))EpN

number 6: (4 + 391.5 = 247)
s{PQ

number 7: (5 + 41.5 = 13)
"PPCG

number 8:  (12 + 121.5 = 53)
VK/@Q2 1*KhN

number 9 (13 + 131.5 = 59)
j\ಠcj\ಠcz\o\O

Not the best, I just started learning pyth today and thought I'd give it a try, number 5 really killed my score, I think I can get a few of them shorter but That will just hurt me more on the distances. Any tips from more experienced pyth users are appreciated.

Number 6 is what really killed my score. Well, numbers 5, 6, and 9.

@SuperJedi224 You can change the order of the programs. For example, switching 5 and 7 here would lower the score a bit.

@Eridan Wait, you can do that? I guess I'll do that this afternoon.

@SuperJedi224 You must use one language to write programs that perform the following nine tasks, in any order. Good luck!

5 + 14^1.5 is not 19

Nice work! I believe the Arabic char and ಠ count as 2 bytes each. Also, surely Pyth has a built-in for base conversion?

The 'j' function can convert to a given base but it returns an array of digits.
For example jT2 will convert the number 10 to base 2, but it returns [1, 0, 1, 0] and for higher than base 10 conversions it will just return base10 values for each digit so j1000 36 returns [27, 28] rather than [R, S]

Python 3 (currently invalid), 621 bytes
from numpy import base_repr
import math
print(base_repr(int(input()),36))
print("".join([str(ord(c)) for c in input()]))
if int(input())%1738 == 0:print(True)
else:print(False)
if "q" in input().lower():print(True)
else:print(False)
t=bytes.maketrans(b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",b"bcdefghijklmnopqrstuvwxyzaBCDEFGHIJKLMNOPQRSTUVWXYZA")
print(input().encode("utf-8").translate(t).decode("utf-8"))
print("PPCG")
n=int(input())
for i in range(1,n):
    if i%math.floor(i**0.5)==0:print(i,end=" ")
print("")
y=input()
z=""
for i in y:
    if i.lower()=="o":z+="0"
    else:z+=i
print(z)

Not really that good code but somewhat works :D.
The sum of prime factors is not working. I always get a different result from your example so I removed it.
Also Python does not support the char ಠ so instead it replaces the os with 0s
IO INFO:
1st input: int in base 10 | Output: that number in base 36
2nd input: a string       | Output: Ascii numbers of the string
3rd input: integer        | Output: True or False depending if number is dividible by 1738
4th input: string         | Output: T or F depending if the string has "q" in it
5th input: string         | Output: Caser Cipher +1 of the string
6th: just prints "PPCG" literally
7th input: int n          | Output: first n ints divisible by floor(sqrt(n))
8th input: string         | Output: Replaced all os with 0 (not with ಠ because python does not support that character, don't get too mad :) )

Oh, yeah. Could you please do a basic explanation of calculating prime factors because I always get a different result from the one in your example.

Welcome to Programming Puzzles and Code Golf! This doesn't quite meet the requirements of the challenge since the challenge is requesting a different program for each task. Additionally, you'll need to follow the scoring rules for this challenge, particularly noting the Levenshtein distance function.

Python does support ಠ, just put a u in front of the string. u"ಠ_ಠ" <- like this


text:
A most excellent proof, too small to fi—!
You sit at home, rubbing your hands in a most evil fashion. This time, I'll be able to set the community A-SPIN! I'll merely claim that I have proven this problem (which is of no doubt improvable) inside this book here… You open to the first relevant page. You scrawl those words…
You are, of course, the evil Fermat! Haha, just kidding. You know it didn't happen like this; this is merely the narrative of his evil twin, Format. Format here is too lazy to condense his “proof” into the margin. He has therefore called upon you to do it for him.
Objective Given a proof (string), and a page (text block), "write" into the margin the proof.
Valid page rules
A text block contains a page if and only if it meets the following requirements:

The top and bottom borders are of the form -{10,}\+$ (Regular expression for - at least ten times until a +, then the end of the line).
Every non-top and non-bottom line must end with a |. There will be at least one such line.
There will be at least five spaces from the last | in each line.
All lines are the same width.

So the following is a valid page (the .s are for showing where the maximal margin border is):
-----------------+
Lorem Ipsum.     |
and other  .     |
latin crud .     |
           .     |
        EOF.     |
-----------------+

Here is another page with a wider margin:
------------------------+
Hello world!   .        |
How are you, to.        |
day? --Mme. B  .        |
               .        |
------------------------+

You are to write the given string in the margin, maintaining words that you can, as far as you can. For example, if hello fits on the next line, do not break it on the current line.
I/Os
Filler text
Proof: This is a most excellent proof, too small for anyone!
Text:                       ; not a leading newline
------------------------+
Hello world!            |
How are you, to         |
day? --Mme. B           |
                        |
------------------------+
Output:
------------------------+
Hello world!    This a  |
How are you, to most    |
day? --Mme. B   excellen|
                t proof,|
------------------------+

Proof: Execute the member as an example to the others!
Text:
------------------------------------------------+
Contrary to popular belief, Lorem               |
Ipsum is not simply random text.                |
It has roots in a piece of classical            |
Latin literature from 45 BC, making             |
it over 2000 years old. Richard                 |
McClintock, a Latin professor at                |
Hampden-Sydney College in Virginia,             |
looked up one of the more obscure               |
Latin words, consectetur, from a                |
Lorem Ipsum passage, and going through          |
the cites of the word in classical              |
literature, discovered the undoubtable          |
source. Lorem Ipsum comes from...               |
------------------------------------------------+
Output:
------------------------------------------------+
Contrary to popular belief, Lorem      Execute  |
Ipsum is not simply random text.       the      |
It has roots in a piece of classical   member as|
Latin literature from 45 BC, making    an       |
it over 2000 years old. Richard        example  |
McClintock, a Latin professor at       to the   |
Hampden-Sydney College in Virginia,    others!  |
looked up one of the more obscure               |
Latin words, consectetur, from a                |
Lorem Ipsum passage, and going through          |
the cites of the word in classical              |
literature, discovered the undoubtable          |
source. Lorem Ipsum comes from...               |
------------------------------------------------+

Proof: Consider supercalifragilisticexpialidocious. Therefore, x.
Output:
-----------------------------------------+
sections 1.10.32 and                     |
1.10.33 of "de Finibus                   |
Bonorum et Malorum"                      |
(The Extremes of Good                    |
and Evil) by Cicero,                     |
written in 45 BC. This                   |
book is a treatise on                    |
the theory of ethics,                    |
very popular during the                  |
Renaissance. The first                   |
line of Lorem Ipsum,                     |
"Lorem ipsum dolor sit                   |
amet..", comes from a                    |
line in section 1.10.32.                 |
-----------------------------------------+
Output: Consider supercalifragilisticexpialidocious. Therefore, x.
-----------------------------------------+
sections 1.10.32 and     Consider        |
1.10.33 of "de Finibus   supercalifragili|
Bonorum et Malorum"      sticexpialidocio|
(The Extremes of Good    us. Therefore, x|
and Evil) by Cicero,     .               |
written in 45 BC. This                   |
book is a treatise on                    |
the theory of ethics,                    |
very popular during the                  |
Renaissance. The first                   |
line of Lorem Ipsum,                     |
"Lorem ipsum dolor sit                   |
amet..", comes from a                    |
line in section 1.10.32.                 |
-----------------------------------------+

Proof: Alex is a bird. All birds can fly. All things that fly are wrong. Ergo, Alex is wrong.
Text:
----------+
Sorry     |    ; 5 spaces.
----------+
Output:
----------+
Sorry Alex|
----------+

This is a code-golf, so the shortest program in bytes wins!

Leaderboard

var QUESTION_ID=63683,OVERRIDE_USER=8478;function answersUrl(e){return"http://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"http://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?([-\.\d]+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

Little new to codegolf, can I pick up the page and proof from files?  Or do they have to come from user I/O?

@wnnmaw welcome to code golf! If it is better, you may choose to read from a file.

Possible dupe

@Mego Not quite. This wants you to recognize a "margin", in addition; that text must have been justified, not merely split.

Well, thanks for teaching me about lorem ipsum. :P

Python 2, 334
p=open("f.txt",'r').readlines()
r,S,p=p[0][7:],p[2].strip(),p[3:-1]
import textwrap as t,itertools as i
m,l=max([len(s[:-5].strip()) for s in p]),len(S)-2
P = i.izip_longest(["{} {{:{}}}|".format(s[:m],l-m) for s in p],t.wrap(r,l-m),fillvalue="")
print S
for q in P:
 if not q[0]:break
 print q[0].format(q[1])
print S

Sample IO with contents of f.txt followed by code output
Case 1
Proof: This is a most excellent proof, too small for anyone!
Text:
------------------------+
Hello world!            |
How are you, to         |
day? --Mme. B           |
                        |
------------------------+

------------------------+
Hello world!    Proof:  |
How are you, to This is |
day? --Mme. B   a most e|
                xcellent|
------------------------+

Case 2
Proof: Consider supercalifragilisticexpialidocious. Therefore, x.
Output:
-----------------------------------------+
sections 1.10.32 and                     |
1.10.33 of "de Finibus                   |
Bonorum et Malorum"                      |
(The Extremes of Good                    |
and Evil) by Cicero,                     |
written in 45 BC. This                   |
book is a treatise on                    |
the theory of ethics,                    |
very popular during the                  |
Renaissance. The first                   |
line of Lorem Ipsum,                     |
"Lorem ipsum dolor sit                   |
amet..", comes from a                    |
line in section 1.10.32.                 |
-----------------------------------------+

-----------------------------------------+
sections 1.10.32 and     Consider superca|
1.10.33 of "de Finibus   lifragilisticexp|
Bonorum et Malorum"      ialidocious.    |
(The Extremes of Good    Therefore, x.   |
and Evil) by Cicero,                     |
written in 45 BC. This                   |
book is a treatise on                    |
the theory of ethics,                    |
very popular during the                  |
Renaissance. The first                   |
line of Lorem Ipsum,                     |
"Lorem ipsum dolor sit                   |
amet..", comes from a                    |
line in section 1.10.32.                 |
-----------------------------------------+

Case 3
Proof: Alex is a bird. All birds can fly. All things that fly are wrong. Ergo, Alex is wrong.
Text:
----------+
Sorry     |
----------+

----------+
Sorry Alex|
----------+

When given a word that does not fit one the rest of one line, your program should put it on the next line.

Where do you see it not performing this way?

In your first example, "excellent" should be put on the next line; in your second example, "superca" should be also put on the next line. Sorry for the ambiguity there.

But "excellent" does not fit on the next line, it has to break either way so I do not see how this is inconsistent with the rules as they are currently written.  I currently do not know any way to implement the code as you are  now describing

You have a point there, that is how it is worded. My fault entirely, your code is fine.


text:
Combined 100 year birthday
I was recently adding up the ages of myself and my wife and kids and realised that at some point in the not-too-distant future our ages will all add up to exactly 100 years.
Challenge
For an input consisting of a combined (total) age and a list of birth dates, output the date on which the combined ages all add up to the given total.

Input combined age (in years) will be a positive integer
Input list of birth dates will be a list (whatever format is convenient for your language) of dates that must contain numerical representation of Day, Month and Year.  Number of days since a specific epoch is not acceptable.  You may assume the list of input dates is sorted in chronological order.
Output will be a single date in the same format as input dates
For the purposes of the combined age, 1 year is considered to be exactly 365.25 days
For some inputs, it will be impossible to find a date after all the birth dates when they all add up to the combined age.  For instance consider two birth dates that are 20 years apart, but we want a combined of 10 years.  In that case, the output would be the 10th birthday of the older birth date.  In other words, individual ages are considered to be 0 for all dates before that individual's birth date
The output will be the first date on which the combined ages add up to at least the input age
You may use built-in date-time functions
You must support dates going back as far as 1970/01/01.

Examples
Here I'm giving all dates in YYYY/MM/DD format, but you may whatever format you like.
Input                                               Output

 10  2000/01/01                                     2010/01/01
100  1975/03/05,1978/07/23,2008/11/12,2012/12/20    2018/11/22
100  1975/03/06,1978/07/23,2008/11/12,2012/12/20    2018/11/23
100  1975/03/09,1978/07/23,2008/11/12,2012/12/20    2018/11/23
100  1975/03/10,1978/07/23,2008/11/12,2012/12/20    2018/11/24
  3  1990/08/01,1995/07/02                          1993/08/01
 50  1975/03/05,1978/07/23,2008/11/12,2012/12/20    2001/11/13

Note that in the last two examples, the output date lies within the range of input dates, as per rule 5.

@TimmyD.  Rule 7 is a may rule, so you don't have to follow it if you don't want to.  I suspect date-time functions will be useful for parsing of input dates and formatting of output dates.  YMMV.

Rule 7 is a May rule. It can be safely ignored this month (and for the next half year).

Realistically, I think a family would check at each birthday, counting years as integers and not trying to sum up the days (with 0.25 to complicate matter).

@edc65 Who ever let reality get in the way of a good PPCG challenge? ;-)

Mathematica 138 107 237 bytes
My first attempts were sloppy and unworthy. This should work generally, provided that the birth dates are given in order of earliest to latest, as in the test cases.
The test cases were well-chosen and difficult to implement correctly.
The code turned out way longer than I had hoped.
The general logic is to

Solve for x (in days) such that the distance from x to each date of birth sums to the target passage of time (e.g 100 years converted to days).
If the earliest date + x days > latest date of birth, remove the latest date of birth and repeat step (1), Else move to (3).
Return (earliest date + x days)

t_~f~d_:=If[DateDifference[a=DateObject[DatePlus[d[[1]],Solve[t 365.25==Tr@(x-Join[{0},
QuantityMagnitude@(DateDifference[d[[1]],#,"Day"]&/@Rest@d)]),{x}][[1,1,2]]]/.
{y_,m_,n_,h_}:>{y,m,n+1}],d[[-1]]]>Quantity[0,"Days"],f[t,Most@d],a]

Test Cases
f[10, {{2000, 1, 1}}]
f[100, {{1975, 3, 5}, {1978, 7, 23}, {2008, 11, 12}, {2012, 12, 20}}]
f[100, {{1975, 3, 6}, {1978, 7, 23}, {2008, 11, 12}, {2012, 12, 20}}]
f[100, {{1975, 3, 9}, {1978, 7, 23}, {2008, 11, 12}, {2012, 12, 20}}]
f[100, {{1975, 3, 10}, {1978, 7, 23}, {2008, 11, 12}, {2012, 12,  20}}]
f[3, {{1990, 8, 1}, {1995, 7, 2}}]
f[50, {{1975, 3, 5}, {1978, 7, 23}, {2008, 11, 12}, {2012, 12, 20}}]

Also, you don't need the space.

PowerShell, 145 125 Bytes
param($a,$b)$c=@();$b|%{$c+=date $_};$t=$a*365.25;$d=$c[0];while($t-gt0){$c|%{if($_-le$d){$t--}};$d=$d.AddDays(1)}"{0:d}"-f$d

Pretty tricksy challenge, but relatively straightforward once understood.
Expanded and Commented:
param($a,$b)          # Take our input
$c=@()                # Make a new array $c
$b|%{$c+=date $_}     # Change our input array $b of strings into dates, store in $c
$t=$a*365.25          # Target number of days we need to account for
$d=$c[0]              # Our starting date, also our cumulative date for output
while($t-gt0){        # While we still have days remaining
  $c|%{               # Iterate through our birthdays
    if($_-le$d){$t--} # If the birthday is less than our cumulutive day, subtract a day
  }
  $d=$d.AddDays(1)    # We've accounted for another day, so increment our cumulative day
}
"{0:d}"-f$d           # Format output

Example:
Input needs to contain an explicitly formatted array of string-date representations. Output is in MM/DD/YYYY format (default for en-us localization in PowerShell).
PS C:\Tools\Scripts\golfing> .\combined-100-year-birthday.ps1 50 @('03/05/1975','07/23/1978','11/12/2008','12/20/2012')
11/13/2001

Edit -- Golfed 20 bytes by changing how we iterate through birthdays, and by using while instead of do/until

PHP, 220 bytes
I've added some newlines for readability.
function c($y,$s){for($d=$y*365.25;++$i<count($l=array_map(date_create,$s));)$d+=
$l[0]->diff($l[$i])->days;($l[$i-1]>$r=$l[0]->add(new DateInterval(P.ceil($d/$i).D)
))?c($y,array_slice($s,0,-1)):print$r->format('Y/m/d');}

Ideone
Here is the ungolfed version:
function printCombinedBirthday($combinedAgeInYears, $listOfBirthDatesStrings)
{
    $combinedAgeInDays = $combinedAgeInYears * 365.25;
    $listOfBirthDates = array_map('date_create', $listOfBirthDatesStrings);
    $numberOfBirthDates = count($listOfBirthDates);

    for ($i = 0; $i < $numberOfBirthDates; ++$i) {
        $combinedAgeInDays += $listOfBirthDates[0]->diff($listOfBirthDates[$i])->days;
    }

    $combinedAgeInDays = ceil($combinedAgeInDays / $numberOfBirthDates);
    $interval = new DateInterval('P'. $combinedAgeInDays .'D');
    $result = $listOfBirthDates[0]->add($interval);

    if ($listOfBirthDates[$numberOfBirthDates - 1] > $result)
    {
        printCombinedBirthday(
            $combinedAgeInYears,
            array_slice($listOfBirthDatesStrings, 0, -1)
        );
    }
    else {
        echo $result->format('Y/m/d');
    }
}


text:
Can you handle the pub?
Background
It's late Friday afternoon and you and your friends decide to hit the pub later that evening, but before going to the pub you figure you should have a few beverages.
However, things escalate quickly; your friend Shaddock Pamplemousse won the lottery earlier this week and decided to bring crates upon crates with different beverages.
The security at the pub is very strict, and if you overconsume before trying to enter the premises you are not allowed inside.
You are all programmers though - so you figure things will turn out great anyway.
Challenge
You need to program an alcohol meter which outputs truthy/falsy if you're above/below the reasonable pub limit.
Before you go down to the pub you enter the amount and beverage type you've consumed during the evening to stdin which your measurement program reads.
If it outputs truthy, you are above the pub limit and stay at home. If it outputs falsy, you're good to go.
Input
One integer greater than 0 which represents your body weight in kilograms followed by a newline.
This input is followed by a series of one digit amounts and beverages on the following form:
<amount><amount type>o<beverage type>

For one bottle of beer this will look like:
1Bob

Each input is separated by a space.
Input specification
Each beverage has a unit which correspond to the impact caused by it.
If you consume more units than your weight divided by two the pub is not an option anymore.
(This may or may not reflect reality)
The following are valid beverages and the corresponding alcoholic units of the beverage:

Beer: b, 1 unit
Energy drink: e, 0 units
Hot sauce: h, 2 units (strong stuff)
Juice (made of organic fruits etc): j, 0 units
Rum: r, 6 units
Tequila: t, 7 units
Vodka: v, 6 units
Wine: w, 3 units

There are different amount types:

Bottle: B
Crate: C
Glass: G
Keg: K
Sip: S

Each amount type has a multiplier which multiplies the alcoholic units of the beverage contained in it:

Bottle: 3
Crate: 25
Glass: 2
Keg: 50
Sip: 0.2

Output
Your program shall output truthy/falsy to stdout if the amount consumed is above/below your body weight divided by 2. If the amount consumed is equal to your weight divided by 2, you should output falsy.
Samples of possible input and output
Input
70
1Bob 3Soj

Output
False

Input
2
1Cov

Output
1

Input
50
1Cob

Output
0

Input
100
4Gow 1Koe 1Bov 1Gow 2Sot

Output
True

The shortest program in bytes wins!

It seems that the o is a format character, though you've not said so specifically. You should clarify this (as o also refers to olive oil.) 2. What do we output if we are exactly on the limit? or doesn't it matter?

Good call; I totally missed that. I'm removing olive oil (who drinks that anyway?)
Below or equal to the limit should output falsy. I'll add that.

Will there ever be more than one digit of drink? Eg, 43Gow?

+1 good question, but it's Friday afternoon and I need to go out for a beer.  Maybe Monday:)

I intended for it to be any amount really - except for negative amounts. I didn't think that would come off as ambiguous. I realize if I change this it will invalidate your answer, and that's not how we do things.
Amount will be clarified as one digit.

I had originally assumed it was multi-digit numbers, but the test cases only showed one digit.

♪99Bob on the wall~♪

CJam, 53 bytes
6:B50:C2*:K4:G.4:S];q"behjrtvwo ""10206763*"er~*]:-U<

Try it online in the CJam interpreter.
How it works
6:B          e# Push 6 and save it in B.
50:C         e# Push 50 and save it in C.
2*:K         e# Multiply by 2 to push 100 and save it in K.
4:G          e# Push 4 and save it in G.
.4:S         e# Push 0.4 and save it in S.
             e#
             e# The letters representing the types will now push its doubled
             e# (to avoid diving the weight by 2) associated multiplier.
];           e# Clear the stack.
q            e# Read all input.
"behjrtvwo " e# Push the string of beverages, concatenated with "o ".
"10206763*"  e# Push the string of associated units of alcohol and '*'.
er           e# Transliterate. This replaces each beverage letter with the
             e# associated units of alcohol, and each 'o' and ' ' with '*'.
             e#
             e# For example, the input
             e# 70
             e# 1Bob 3Soj
             e# is transformed into
             e# 70
             e# 1B*1*3S*0
             e#
~            e# Evaluate the resulting string.
             e#
             e# For the example this does the following:
             e#   + Push 70.
             e#   + Push 1, push 6, multiply, push 1, multiply.
             e#   + Push 3, push 0.4, multiply, push 0.
             e#
*            e# Multiply the last two (for the lack of a trailing space).
]            e# Collect all results in an array.
:-           e# Reduce by subtraction; subtract all other elements from the
             e# first element (body weight).
U<           e# Compare the result with 0.

Python 3, 131
Now we're golfing with snakes!
Saved 18 bytes thanks to shebang.
Saved 4 more bytes thanks to DSM.
Saved a lot of bytes thanks to tzaman.
Many thanks to tzaman for his brilliant trick of abusing .find() returning -1 if it doesn't find a value.
Currently this assumes this drink format is exactly the way it's stated in the challenge, eg, only 1 digit worth of each drink.
w=input()
print(sum([6,50,4,100,.4]['BCGKS'.find(b)]*int(a)*int('1267730'['bhrtvw'.find(v)])for a,b,_,v in input().split())>int(w))

I think it may be good if you dropped the dicts and did everything in the print statement. So, remove m and replace the m[p[-1]] bit with [3,25,2,50,.2]['BCGKS'.find(p[-1])], and the same with d. I got down to 168 with those changes to your code.

Minkolang 0.11, 59 bytes
126763355*25l*2l$:"SKGCBwvtrhb"m(0pI)n(no0qoxo0q**2*-$I)`N.

Try it here.
Explanation
126763355*25l*2l$:    Pushes the values of the characters
"SKGCBwvtrhb"         Pushes the characters themselves
m                     Merge; interleaves the first and second halves of the stack
(                     Open while loop
 0p                   Put character's value in character's place in the codebox
   I)                 Close while loop when stack is empty
n                     Read in integer (weight)
(                     Open while loop
 n                    Read in integer, ignoring any non-numeric characters
  o0q                 Read in character and get its value from the codebox
     ox               Read in character and dump it
       o0q            Read in character and get its value from the codebox
          **          Multiply the three numbers together
            2*-       Multiply by 2 and subtract from weight
               $I)    Close while loop when input is empty
`                     1 if less than 0, 0 otherwise
 N.                   Output as integer and stop.

I guess CJam is getting outdated... I need to finish my language then

@anOKsquirrel: Or rather, you just haven't golfed it enough. :)

Or rather, both. :P

No, actually, I'm just bad :p

CJam, 54 bytes
ldlS/{A,s"CbretjvwSBK"+f#A,[25X6T7T6Z.2Z50Y]+f=:*-}/0<

Bit fiddly and probably suboptimal, but I think this works okay. Try it online.
Explanation
ld             Read first line, convert to double
lS/            Read second line, split by space
{...}/         For each item in the second line...
  A,s"..."+f#    Get index in "0123456789CbretjvwSBK", or -1 if not found
  A,[...]+f=     Index into [0 1 2 3 4 5 6 7 8 9 25 1 6 0 7 0 6 3 0.2 3 50 2]
  :*             Take product
  -              Subtract from weight
0<             Check if < 0

Note that the numeric array has 2 at the end, meaning that Gho, which are missing from the first string, get mapped to 2.

Ruby, 153 bytes
I need to get rid of the gsubs somehow
w=gets.to_i;$><<(eval(gets.chars{|c|c[/[0-9]/]!=p ? ($_[c]+='*'):0}.tr('behjrtvwo BG','10206763*+32').gsub('C','25').gsub('K','50').gsub('S','0.2'))>w/2)

JavaScript, 131 134 139 bytes
This is a full program and basically an adaption of my PHP answer:
for(c=prompt,b=c(a=c(s=i=0));b[i];i+=2)s+=b[i++]*{B:3,C:25,G:2,K:50,S:.2}[b[i++]]*{b:1,h:2,r:6,t:7,v:6,w:3}[b[++i]]||0;alert(s>a/2)

It reads two values using prompt and alerts the result as [true|false].

Edits

Saved 5 bytes by using a logical expression ||0 instead of declaring the beverages with 0 units. Thanks to user81655.
Saved 3 bytes by storing prompt in a variable and shortening the initialization. Thanks to Stefnotch.

You could save 6 bytes by changing ,e:0,j:0}[b[++i]] to }[b[++i]]|0.

@user81655 Yesterday I was thinking, how to get rid of those 0-values. Well, I didn't think of that. Had to use || instead of the bitwise operator. Still 5 bytes less. Thanks.

No problem. I forgot about the possible non-integer values.

for(s=i=0,a=prompt(),b=prompt(); can be changed to:
for(c=prompt,b=c(a=c(s=i=0));

@Stefnotch That's clever. I like it. Thanks for saving 3 bytes.

CJam, 77
qN%~S%{:BW="behjrtvw"\#10206773s:~\=[3 25 2 50 .2]"BCGKS"B-3=#=*1mO}%:+\~2/\>

 VBA, 251 bytes
Function k(x) As Boolean:q=Split(x):g="b1e0h2j0r6t7v6w3":h="B03C25G02K50S.2":For i=1 To UBound(q):j=j+Left(q(i),Len(q(i))-3)*Mid(h,InStr(h,Mid(Right(q(i),3),1,1))+1,2)*Mid(g,InStr(g,Mid(Right(q(i),3),3,1))+1,1):Next i:If q(0)/2<j Then k=1
End Function

 Using : rather then Newline doesn't make it shorter, But it does look more golfy!

Readable Format
Function b(x) As Boolean
q = Split(x)
g = "b1e0h2j0r6t7v6w3"
h = "B03C25G02K50S.2"
For i = 1 To UBound(q)
j = j + Left(q(i), Len(q(i)) - 3) * _          'Left most digits would be the Quantity
Mid(h, InStr(h, Mid(Right(q(i), 3), 1, 1)) + 1, 2) * _  'Find the Container value in h
Mid(g, InStr(g, Mid(Right(q(i), 3), 3, 1)) + 1, 1)      'Find the Drink value in g
Next i
If q(0) / 2 < j Then b = 1 'Checks if Drunk or not
End Function

Pretty Sure this can be golfed. my String Manipulation with Mid(Right()) seems excessively wordy, But running the array though StrReverse makes it longer. If we assume you only drink 0-9 of any particular drink at a time we can save a handful of bytes
Take input as one string with weight separated by a space as VBA dose not support multi line input

Javascript, 159 bytes
function b(t){return a={B:3,C:25,G:2,K:50,S:.2,b:1,h:2,w:3,r:6,v:6,t:7},t.split(/\W/).reduceRight(function(t,n,r){return r?n[0]*a[n[1]]*a[n[3]]+t||t:t>n/2},0)}

Since Javascript requires a library to access STDIN, this code is just a function that accepts the entirety of the input, i.e. b("100\n4Gow 1Koe 1Bov 1Gow 2Sot")

As a note: prompt() is generally accepted as a valid alternative to STDIN in JavaScript.

You could save 30 bytes by going ES6 and using the arrow-operator: b=t=>(a={B:3,C:25,G:2,K:50,S:.2,b:1,h:2,w:3,r:6,v:6,t:7},t.split(/\W/).reduceRight((t,n,r)=>r?n[0]*a[n[1]]*a[n[3]]+t||t:t>n/2,0)).

Python 3, 157 bytes
n,l,d,u=int(input()),input(),"behjrtvwBCGKS",[1,0,2,0,6,7,6,3,3,25,2,50,.2]
print(sum(map(lambda x:int(x[0])*u[d.find(x[1])]*u[d.find(x[3])],l.split()))>n/2)

bash (+ bc + GNU sed), 200 196 194 bytes
read x
read y
y="$(sed 's/^/((/;s/$/))/;s/ /)+(/g;s/o/*/g;s/b/1/g;s/[ej]/0/g;s/h/2/g;s/[rv]/6/g;s/w/3/g;s/t/7/g;s/B/*3/g;s/C/*25/g;s/G/*2/g;s/K/*50/g;s/S/*0.2/g'<<<"$y")"
echo "$y>$x/2"|bc -l

PHP, 163 169 bytes
for($a=fgets(STDIN),$b=fgets(STDIN),$v=[b=>1,h=>2,r=>6,t=>7,v=>6,w=>3,B=>3,C=>25,G=>2,K=>50,S=>.2];$b[$i];$i+=2)$s+=$b[$i++]*$v[$b[$i++]]*$v[$b[++$i]];echo$s>$a/2;

Outputs 1 or nothing, works for all test cases.

I still wonder what this hot sauce is, having 2 units.

Edits

Saved 6 bytes by merging the two arrays for drinks and multiplier and by removing 0 from 0.2.

Keg, 165 bytes (SBCS)
¿®w?(: =[_]")0®u(!4/|\0-&:B=[&3*&|:C=[&55**&|:G=[&2*&|:K=[&\2*&|&15/*&]]]]__:b=[&1*&|:e=[&0&|:h=[&2*&|:j=[&0&|:r=[&6*&|:t=[&7*&|:v=[&6*&|&3*&]]]]]]]_©u&+®u)©w2/:©u<.

Try it online!
I feel as if though a Keg answer has never been more appropriate! This could probably be golfed, but I don't think it can.
Explained
¿®w                                                                         #Take the weight and store it in a variable
?(: =[_]")                                                                  #Take the second line and remove spaces
0®u                                                                         #Store the units in a variable
(!4/|                                                                       #For every part in the input
\0-&                                                                        #Store the amount of drink in the register
:B=[&3*&|:C=[&55**&|:G=[&2*&|:K=[&\2*&|&15/*&]]]]__                         #Determine the beverage multiplier
:b=[&1*&|:e=[&0&|:h=[&2*&|:j=[&0&|:r=[&6*&|:t=[&7*&|:v=[&6*&|&3*&]]]]]]]_   #Determine the drink
©u&+®u)                                                                     #Add the amount to units
©w2/:©u<.                                                                   #Check the condition and print

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


text:
Calculate Phi (not Pi)
No, I don't mean \$\phi = 1.618...\$ and \$π = 3.14159...\$. I mean the functions.

\$\phi(x)\$ is the number of integers less than or equal to \$x\$ that are relatively prime to \$x\$.
\$π(x)\$ is the number of primes less than or equal to \$x\$.
Let's say that "not pi" is then \$\bar{\pi}(x)\$ and define it to be the number of composites less than or equal to \$x\$.

Task
Given a strictly positive integer \$x\$, calculate \$\phi(\bar{\pi}(x))\$. Scoring is in bytes.
Examples
Each line consists of the input (from 1 to 100, inclusive) and the corresponding output separated by a space.
1 0
2 0
3 0
4 1
5 1
6 1
7 1
8 2
9 2
10 4
11 4
12 2
13 2
14 6
15 4
16 6
17 6
18 4
19 4
20 10
21 4
22 12
23 12
24 6
25 8
26 8
27 16
28 6
29 6
30 18
31 18
32 8
33 12
34 10
35 22
36 8
37 8
38 20
39 12
40 18
41 18
42 12
43 12
44 28
45 8
46 30
47 30
48 16
49 20
50 16
51 24
52 12
53 12
54 36
55 18
56 24
57 16
58 40
59 40
60 12
61 12
62 42
63 20
64 24
65 22
66 46
67 46
68 16
69 42
70 20
71 20
72 32
73 32
74 24
75 52
76 18
77 40
78 24
79 24
80 36
81 28
82 58
83 58
84 16
85 60
86 30
87 36
88 32
89 32
90 48
91 20
92 66
93 32
94 44
95 24
96 70
97 70
98 24
99 72
100 36

Use this link to calculate the expected output for any input. Also, a list of inputs and outputs for \$x \le 1000\$ is provided here on pastebin. (Generated with this Minkolang program.)

Leaderboards
Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
## Language Name, N bytes

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

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:
## Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the leaderboard snippet:
## [><>](http://esolangs.org/wiki/Fish), 121 bytes

var QUESTION_ID=63710,OVERRIDE_USER=12914;function answersUrl(e){return"http://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"http://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

Are there limits on the size of the input?

@ThomasKwa: In theory, no. In practice, up to the limit of your language/device.

Is this question a tribute to the user PhiNotPi?

@primo Why would you think that?

@primo: It was inspired by his name, and definitely a pun on it, but not exactly a tribute to him.

Unclear to me. Examples: 4 --> 1. notPi(4) == 1 (number of composites <= 4). Phi(1) == 1 ??? (number of integers less than or equal to 1 that are relatively prime to 1 ... 1 is relatively prime to itself?).

@edc65: Yes, apparently so, as I found out yesterday.

The primes and the composites are not complementary...

Mathematica answers?

@StanStrum: A simple Ctrl+F would've found you this.

@El'endiaStarman many people use a phone for PPCG and do not have a control key.

@StanStrum: ...you might have a point there. The SE app doesn't have a 'find' feature, although the Chrome app does. (Both on Android.)

@El'endiaStarman To the devs, away!

GS2, 12 10 bytes
V@'◄l.1&‼l

The source code uses the CP437 encoding. Try it online!
Test run
$ xxd -r -ps <<< 564027116c2e3126136c > phinotpi.gs2
$ wc -c phinotpi.gs2
10 phinotpi.gs2
$ gs2 phinotpi.gs2 <<< 1000
552

How it works
V          Read an integer n from STDIN.
 @         Push a copy of n.
  '        Increment the copy of n.
   ◄l      Push 1 and call primes; push the list of all primes below n+1.
     .     Count the primes.
      1    Subtract the count from n.
       &   Decrement to account for 1 (neither prime nor composite).
        ‼l Push 3 and call primes; apply Euler's totient function.

The file name is longer than the program.

Regex (.NET), 122 113 bytes
^(?=((?=.*$(?<=^(\3+(.+.))(.*?(?>(.\4)?)))).)+(.*))((?=.*(?=\6$)(?<=(?!(.+.)\8*(?=\6$)(?<=^\8+))(.+?(?>\9?)))).)+

Assuming input and output are in unary, and the output is taken from the main match of the regex.
Breakdown of the regex:

^(?=((?=.*$(?<=^(\3+(.+.))(.*?(?>(.\4)?)))).)+(.*)) calculates π̅(x) and captures the rest of the string in capturing group 6 for assertion in the second part.

.*$ sets the pointer to the end of the string so that we have the whole number x in one direction.
(?<=^(\3+(.+.))(.*?(?>(.\4)?))) matches from right to left and checks for composite number by looping from x to 0.

(.*?(?>(.\4)?)) is a "variable" which starts from 0 in the first iteration and continues from the number in previous iteration and loops up to x. Since the smallest composite number is 4, (.\4)? never fails to match if capturing group 4 is available.
^(\3+(.+.)) checks what is left by the "variable" above (i.e. x - "variable") whether it is a composite number.

((?=.*(?=\6$)(?<=(?!(.+.)\8*(?=\6$)(?<=^\8+))(.+?(?>\9?)))).)+ calculates φ(π̅(x)), by limiting the left-to-right operations with (?=\6$).

.*(?=\6$) sets the pointer to position π̅(x). Let's denote y = π̅(x).
(?<=(?!(.+.)\8*(?=\6$)(?<=^\8+))(.+?(?>\9?))) matches from right to left and checks for relative prime by looping from (y - 1) to 0

(.+?(?>\9?)) is a "variable" which starts from 1 in the first iteration and continues from the number in previous iteration and loops up to y
(?!(.+.)\8*(?=\6$)(?<=^\8+)) matches from left to right 1 and checks whether the "variable" and y are relative prime.

(.+.)\8*(?=\6$) picks a divisor of "variable" which is larger than 1, and a side effect is that we have whole number y on the left.
(?<=^\8+) checks whether the divisor of "variable" is also the divisor of y.

1 In .NET, look-ahead sets the direction to LTR instead of following the current direction; look-behind sets the direction to RTL instead of reversing the direction.
Test the regex at RegexStorm.
Revision 2 drops non-capturing groups and uses atomic groups instead of conditional syntax.

Sir, you are mad.

He's got a touch of the Zalgo I think.

And now you have two problems.  (Seriously had no idea you could do this kind of thing with Regex...)

J, 15 14 bytes
5 p:<:-_1 p:>:

This is a tacit, monadic verb. Try it online with J.js.
How it works
                Right argument: y
            >:  Increment y.
       _1 p:    Calculate the number of primes less than y+1.
    <:          Decrement y.
      -         Calculate the difference of the results to the left and right.
5 p:            Apply Euler's totient function to the difference.

i can haz explanation? :P

i haz added explanation

I was about to say that I have upvoted this because it has lots of smileys, but the text told me to avoid those :(

@Dennis: Your first reply made me laugh pretty hard, thanks for that!

Seriously, 27 bytes
,;R`p`MΣ(-D;n;;╟@RZ`ig1=`MΣ

Yay, I beat CJam! Try it online
Explanation (a refers to top of stack, b refers to second-from-top):
,;       take input and duplicate it
R`p`MΣ   push sum([is_prime(i) for i in [1,...,a]]) (otherwise known as the pi function)
(-D      rotate stack right by 1, subtract top two elements, subtract 1, push
            (@ could be used instead of (, but I was hoping the unmatched paren would bother someone)
;n;;     dupe top, push a b times, dupe top twice (effectively getting a a+1 times)
╟        pop n, pop n elements and append to list, push
@        swap top two elements
RZ       push [1,...,a], zip a and b
`ig1=`   define a function:
  i        flatten list
  g1=      compute gcd(a,b), compare to 1 (totient function)
MΣ       perform the function a on each element of b, sum and push

Note: since the posting of this answer, I have added the pi and phi functions to Seriously. Here is a noncompetitive answer with those functions:
,;▓1-@-▒

Explanation (some commands are shifted to not overlap others):
,    get input (hereafter referred to as x)
;    duplicate x
 ▓   calculate pi(x) (we'll call this p)
1-   calculate 1-p
@-   bring x back on top, calculate x-1-p (not pi(x))
  ▒  calculate phi(not pi(x))

You have SERIOUSLY OUTGOLFED @Dennis !

Please don't tell me you knew this at the top of your head..

GJ beating CJam=)

Julia, 52 50 bytes
x->count(i->gcd(i,p)<2,1:(p=x-endof(primes(x))-1))

This creates an unnamed function that accepts and integer and returns an integer. To call it, give it a name, e.g. f=x->....
Ungolfed:
function phinotpi(x::Integer)
    # The number of composites less than or equal to x is
    # x - the number of primes less than or equal to x -
    # 1, since 1 is not composite
    p = x - length(primes(x)) - 1

    # Return the number of integers i between 1 and p such
    # that gcd(i, p) = 1. This occurs when i is relatively
    # prime to p.
    count(i -> gcd(i, p) == 1, 1:p)
end

Use sum instead of count to save a couple of characters. It's a little frustrating, though - the other way to count the primes, sum(isprime,1:x), is exactly the same length as endof(primes(x)).

@GlenO Thanks for the suggestion, but sum fails for empty collections while count returns 0. Thus sum won't produce the desired result for x<4.

Mathematica, 24 bytes
EulerPhi[#-PrimePi@#-1]&

Of course Mathematica has all of this built in...

@ConfusedMr_C Obviously :) However, it wasn't disqualified, for an obvious reason: mathematical software cannot beat golfing languges in simple combinatorial tasks :)

@ConfusedMr_C PhiNotPi@#&: 11 bytes :P

Minkolang 0.11, 12 bytes (NOT competitive)
This answer is NOT competitive. I implemented pi and phi as built-ins before I posted the question, which gives me an unfair advantage. I post this only for those who are interested in the language.
nd9M-1-9$MN.

Try it here.
Explanation
n      Read in integer from input
d      Duplicate
9M     Pops off the top of stack as x and pushes pi(x)
-      Subtracts the top two elements on the stack (x - pi(x))
1-     Subtracts 1 (x-1 - pi(x))
9$M    Pops off the top of stack as x and pushes phi(x) (phi(x-1 - pi(x)))
N.     Outputs as integer and stops.

I don't think publishing invalid answers is a good idea...

As long as they have a disclaimer, I don't think there's anything wrong with it. It's actually pretty common for older challenges.

@yeti: Technically, it's not invalid. The features used here were all implemented before the challenge was posted. I simply disqualify it because I delayed posting the challenge until two particular features were implemented (which I used to generate the example lists, incidentally).

Same. I do this a lot when  keeps getting updated.

Pyth, 14 bytes
JlftPTSQ/iLJJ1

Demonstration, Verifier
We calculate composites using a simple filter, take its length, and save it to J. Then, we take the gcd of J with every number up to J, and count how many results equal 1.

Python, 137 139
n=input()
print n,len([b for b in range(len([a for a in range(n)if not all(a%i for i in xrange(2,a))]))if all(b%i for i in xrange(2,b))])

I think you can save 2 bytes by removing the spaces between range(n) if and ])) if

Given Python's relatively low Golf-ability (because of the whitespace requirements, etc.) this is pretty impressive!

@DankMemes, thanks for the tip!

CJam, 28 bytes
ri){mf1>},,_,f{){_@\%}h)=}1b

Try it this fiddle in the CJam interpreter or verify all test cases at once.
How it works
ri                            Read an integer N from STDIN.
  )                           Increment it.
   {    },                    Filter; for each I in [0 ... N]:
    mf                          Push I's prime factorization.
      1>                        Discard the first prime.
                              If there are primes left, keep I.
          ,                   Count the kept integers. Result: C
           _,                 Push [0 ... C-1].
             f{          }    For each J in [0 ... C-1], push C and J; then:
               )                Increment J.
                {    }h         Do:
                 _                Push a copy of the topmost integer..
                  @               Rotate the integer below on top of it.
                   \%             Take that integer modulo the other integer.
                                If the residue is non-zero, repeat the loop.
                                This computes the GCD of C and J+1 using the
                                Euclidean algorithm.
                       )        Increment the 0 on the stack. This pushes 1.

                        =     Push 1 if the GCD is 1, 0 if not.
                          1b  Add all Booleans.

I tried the "verify all cases" link and got this: 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111. Is that right?

Yes, it checks that applying the code to the left column (input) equals the right column (output).

Ah, so it's 100 1s, thus proving that all outputs were as expected. Neat!

i can haz explanation on dis1?

@anOKsquirrel i haz explained dis1 2

@Dennis kthxbai

Regex (.NET), 88 86 bytes
^(?=((?=(..+)\2+$)?.)+)(?=(?<-2>.)*(.+))(?=(((?!(..+)\6*(?<=^\6+)\3$))?.)*\3)(?<-5>.)*

Try it online! (As a Retina program.)
Uses the same I/O as n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ 's answer, i.e. unary input and it matches a substring of the length of the result.
It might be possible to shorten this further by replacing one or both of the balancing groups with forward references.
Alternative at the same byte count:
^(?=((?=(..+)\2+$)?.)+)(?=(?<-2>.)*(.+))(?=(?((..+)\4*(?<=^\4+)\3$).|(.))*\3)(?<-5>.)*

There are also some alternatives for the first half, e.g. using a negative lookahead instead of a positive one for the compositive numbers, or using a conditional there as well.
Explanation
I'll assume that you have a basic understanding of balancing groups, but in short, capturing groups in .NET are stacks (so each time you reuse the capturing group the new capture is pushed on top) and (?<-x>...) pops a capture from stack x. That's very helpful for counting things.
^                   # Only look at matches from the beginning of the input.
(?=                 # First, we'll compute the number of composites less than
                    # or equal to the input in group 2. This is done in a
                    # lookahead so that we don't actually advance the regex
                    # engine's position in the string.
  (                 #   Iterate through the input, one character at a time.
    (?=(..+)\2+$)?  #     Try to match the remainder of the input as a
                    #     composite number. If so the (..+) will add one
                    #     one capture onto stack 2. Otherwise, this lookahead
                    #     is simply skipped.
    .
  )+
)
(?=                 # It turns out to be more convienient to work with n minus
                    # the number of composites less than or equal to n, and to
                    # have that a single backreference instead of the depth of
                    # a stack.
  (?<-2>.)*         #   Match one character for each composite we found.
  (.+)              #   Capture the remainder of the input in group 3.
)
(?=                 # Now we compute the totient function. The basic idea is
                    # similar to how we computed the number of composites,
                    # but there are a few differences.
                    # a) Of course the regex is different. However, this one
                    #    is more easily expressed as a negative lookahead (i.e.
                    #    check that the values don't share a factor), so this
                    #    won't leave a capture on the corresponding stack. We
                    #    fix this by wrapping the lookahead itself in a group
                    #    and making the entire group optional.
                    # b) We only want to search up the number of composites,
                    #    not up to the input. We do this by asserting that we
                    #    can still match our backreference \3 from earlier.

  (                 #   Iterate through the input, one character at a time.
    ((?!            #     Try not to match a number that shares a factor with
                    #     the number of composites, and if so push a capture
                    #     onto stack 5.
      (..+)\6*      #     Look for a factor that's at least 2...
      (?<=^\6+)     #     Make sure we can reach back to the input with that
                    #     factor...
      \3$           #     ...and that we're exactly at the end of the number
                    #     of composites.
    ))?
    .
  )*
  \3                #   Match group 3 again to make sure that we didn't look
                    #   further than the number of composites.
)
(?<-5>.)*           # Finally, match one character for each coprime number we
                    # found in the last lookahead.

Retina, 48 bytes
.+
$*
M&`(..+)\1+$
.+
$*
(?!(..+)\1*$(?<=^\1+)).

Try it online!
Explanation
.+
$*

Convert input to unary.
M&`(..+)\1+$

Count composite numbers not greater than the input by counting how often we can match a string that consists of at least two repetitions of a factor of at least 2.
.+
$*

Convert to unary again.
(?!(..+)\1*$(?<=^\1+)).

Compute φ by counting from how many positions it is not possible to find a factor (of at least 2) of the suffix from that position which is also a factor of the prefix (if we do find such a factor then this i <= n shares a factor with n is therefore not coprime to it). The . at the end ensures that we don't count zero (for which we can't find a factor of at least 2).

PARI/GP, 27 bytes
n->eulerphi(n-1-primepi(n))

Jelly, 7 bytes
ÆC_@’ÆṪ

How it works
ÆC_@’ÆṪ  Input: n

ÆC       Count the primes less than or equal to n.
    ’    Yield n - 1.
  _@     Subtract the count from n - 1.
     ÆṪ  Apply Euler's totient function.

Gaia, 5 bytes
ṗ⁈l(t

Try it online!

ṗ⁈l(t   ~ Full program.

 ⁈      ~ Reject the elements that:
ṗ         ~ Are prime.
  l     ~ Length.
   (    ~ Decrement.
    t   ~ Euler's totient.

SageMath 26 bytes
euler_phi(n-1-prime_pi(n))

Works well even for n=0 and n=1, thanks to Sage's implementation.

PARI/GP, 35 bytes
n->eulerphi(sum(x=2,n,!isprime(x)))

Jelly, 6 bytes
_ÆC’ÆṪ

Try it online!
This is a collaboration between caird coinheringahhing and Mr. Xcoder in chat
Explanation

_ÆC’ÆṪ   ~ Full program.

 ÆC      ~ Count the primes less than or equal to Z.
_        ~ Subtract from the input.
   ’     ~ Decrement.
    ÆṪ   ~ Euler's totient function.

Ohm v2, 7 bytes
³³Pl-‹φ

Try it online!

Octave, 52 51
@(b)nnz((d=[1:(c=b-1-nnz(primes(b)))])(gcd(d,c)<2))

Edit: saved 1 byte thanks to Thomas Kwa
Explanation:
@(b)                                            # Define anonymous func with parameter b
  nnz(                                          # Count elements in φ(c)
    (                                           #
      d = [1:                                   # Create d= array of 1 to π̅(b)
            ( c = b - 1 - nnz(primes(b)) )      # Calculate c=π̅(b) by subtracting the
                                                #  number of elements in the array of prime
          ]                                     #  numbers from the number of ints in 2:b
    )(gcd(d, c) < 2)                            # Calculate φ(c) by using gcd to filter
  )                                             # relative primes from d

MATL, 9 bytes
:Zp~sq_Zp

Uses version (10.1.0) of the language/compiler.
Try it online!
Explanation
:       % implicitly input a number "N" and produce array [1,2,...,N]
Zp      % true for entries that are prime
~       % negate. So it gives true for entries of [1,2,...,N] that are non-prime
s       % sum elements of array. So it gives number of non-primes
q       % subtract 1. Needed because number 1 is not prime, but not composite either
_       % unary minus
Zp      % with negative input, computes totient function of absolute value of input
        % implicit display

GAP, 33 Bytes
n->Phi(n-Number([-2..n],IsPrime))

Number(l,p) counts how many elements from l satisfy p. To compensate for the fact that 1 is neither prime nor composite, I have to subtract from n one more than the number of primes up to n. Instead of doing -1 for two bytes, I start the list by -2 instead of 1 or 2, thus adding one more number that is considered prime by IsPrime for only one extra byte.

Python 3.5 - 130 bytes
from math import*
def p(n,k,g):
 for i in range(1,n+1):k+=factorial(i-1)%i!=i-1
 for l in range(1,k):g+=gcd(k,l)<2
 return g

If it's not acceptable to pass the function through as p(n,0,0) then +3 bytes.
This takes advantage of the fact that I use Wilson's theorem to check if a number is composite and have to call into the math module for the factorial function. Python 3.5 added a gcd function into the math module.
The first loop of the code will increment k by one if the number is composite and increment by 0 else-wise. (Although Wilson's theorem only holds for integers greater than 1, it treats 1 as prime, so allows us to exploit this).
The second loop will then loop over the range of number of composites and increment g only when the value of not pi and l are co-prime.
g is then the number of values less than or equal to the number of composite numbers less than or equal to n.

Python 3 + sympy, 59 58 bytes
*-1 byte by replacing compositepi(k) with k+~primepi(k).
lambda k:totient(k+~primepi(k))
from sympy.ntheory import*

Try it online!

05AB1E, 11 8 bytes
LDpÈÏg<Õ

Try it online!
How it works
L             # this gets us the list of numbers [1 .. a]
 D            # duplicates this list
  p           # applies isPrime to each element of the list, vectorised.
   È          # is the element even? (does 05AB1E not have a logical not?)
    Ï         # push elements of the first list where the same index in the
              # second list is 1
     g<       # finds the length and subtracts 1 (as the list contains 1)
              # this is the not pi function
       Õ      # euler totient function

Pyt, 6 bytes
řṗ¬Ʃ⁻Ț

Explanation:
                Implicit input
ř               Push [1,2,...,input]
 ṗ              [is 1 prime?, is 2 prime?, ..., is input prime?]
  ¬             [is 1 not prime?, is 2 not prime?, ... is input not prime?]
   Ʃ            Number of non-primes (sums the array - booleans implicitly converted to ints)
    ⁻           Subtract one to remove the counting of '1'
     Ț          Euler's totient function

Try it online!

APL NARS, 38 bytes, 19 chars
{⍵≤3:0⋄13π¯1+⍵-2π⍵}

13π is the totient function and 2π is the count prime function<= its argument. Test
  b←{⍵≤3:0⋄13π¯1+⍵-2π⍵}
  (⍳12),¨b¨⍳12
1 0  2 0  3 0  4 1  5 1  6 1  7 1  8 2  9 2  10 4  11 4  12 2
  (95..100),¨b¨(95..100)
95 24  96 70  97 70  98 24  99 72  100 36

Add++, 21 bytes
L,RþPbL1_dRdVÞ%bLG!!+

Try it online!
How it works
This simply implements \$\overline\pi(n)\$ and \$\varphi(n)\$ without using the two explicit functions (mainly because they aren't builtin). The code can therefore be split into two sections: \$\overline\pi(n)\$ and \$\varphi(n)\$.
\$\overline\pi(n)\$
RþPbL1_

Here, operating on the input directly, we generate a range from [0 .. n] with R, then remove any primes with þP (filter false (þ) prime elements (P)). Unfortunately, this doesn't remove 1, as it isn't prime. Therefore, after taking the number of elements left with bL, we decrement once 1_ to remove the count for 1. This leaves \$x = \overline\pi(n)\$ on the stack.
\$\varphi(n)\$
dRdVÞ%bLG!!+

This one is rather longer, due once again to 1. First, we duplicate \$x\$ and create a range to operate over with dR. Next, we save a copy of this range for a check we'll address later. Then, using filter true Þ%, we remove any elements that divide \$x\$, or keep any elements that have a GCD of 1 with \$x\$. Finally, we take the length of this list with bL.
Unfortunately, this yields 0 when the result should be 0 and \$n - 1\$ when the correct result is \$n\$. In order to fix this discrepancy, we retrieve the saved range with G, and convert it into a boolean value with !!. This makes empty ranges (which would yield 0) into 0 and every other range into 1. Finally, we add this value to our previous result and return it.
Yes, I did really want to try the new LaTex

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