text:
Fill the rows, columns, and diagonals of an NxN grid with 1 through N
Task
Given input N, generate and output an NxN grid where each row, column and the two diagonals contain the numbers 1 to N (or 0 to N−1 if that's easier).
Input
The input is a positive integer N. It represents the number of columns and rows in the grid. For this problem, you can assume N will be a reasonable size, 4 ≤ N ≤ 8 or (1 ≤ N ≤ 8 if you go for the bonus below).
Output
The output will be the N×N grid. In the grid, each row only contains the numbers 1 to N, each column only contains the numbers 1 to N, and the two diagonals of length N (the one from (0,0) to (N-1,N-1) and the one from (0,N-1) to (N-1, 0)) only contain the numbers 1 to N. You can use the numbers 0 to N−1. For each N, there are many possible solutions, you only need to print the first one you find. You don't need to print spaces between the numbers.
Constraints
Your code should be able to repeatably produce results for N >= 7. That is, if you're able to actually run and get a solution for N = 7 from your code each time, you're good. In terms of an absolute limit, your code should be able to solve for N = 7 in under 10 minutes each time you run it (i.e., if you depend on random numbers, for the worst case, your code should still finish in under 10 minutes for N = 7).
Examples

Input: 4
One possible output:
1 2 3 4
3 4 1 2
4 3 2 1
2 1 4 3

Input: 5
One possible output:
1 2 3 4 5
5 3 1 2 4
2 5 4 3 1
4 1 2 5 3
3 4 5 1 2

Input: 8
One possible output:
1 2 3 4 5 6 7 8
2 3 1 5 4 8 6 7
4 1 2 3 7 5 8 6
6 4 7 8 1 2 3 5
7 5 8 2 6 3 4 1
5 8 4 6 2 7 1 3
8 7 6 1 3 4 5 2
3 6 5 7 8 1 2 4

Scoring
This is code-golf, so the shortest code in bytes wins, with one exception. For inputs N = 2, 3 there are no valid solutions. If your code can handles this (run to completion without outputting anything for these cases, or outputting an empty string), and still handles N = 1 (outputs 1 for it), take 20% off your byte count.

Related, but such a grid won't work here because of the diagonals requirement.

I like this challenge but I can't figure out an algorithm for even values of N. This JavaScript code works for N = 1, 5 or 7 though if it helps anyone: for(o="",y=N;y--;o+="\n")for(x=N;x--;)o+=(((N-y)*2+x)%N)+1

Very related, possible duplicate: http://codegolf.stackexchange.com/q/47846/15599

@steveverrill That wasn't code golf though.

@steveverrill, although the title made it seem that that should be a duplicate, the question was actually asking for something different to the title. I've corrected the title.

@PeterTaylor I'd never heard of a greco-latin square, but it's basically just 2 superimposed latin squares. The biggest difference seems to be that the other question requires all wrapped diagonals to contain every number, whereas this one only requires the two main diagonals to contain every number. Hence this one has a solution for N=4 but the other one doesn't.

Do we have to output the solution almost exactly like in your examples, or can we for example return a list of lists containing the values?

@Fatalize each line of your output should be one row of the board your code generated. The line can be formatted however you want.

Maybe you should be more explicit about the N = 1 case: answers that aim for the bonus should return 1, not the empty string.

@Mauris, thank you, I'll add that

Python 3, 275 260 Bytes*0.8= 220 208 Bytes
Recursive/backtracking approach. R is the recursive function, l is the coLumn, w is the roW, K is the next entry.
I chose to put it in a 1d array and pretty-print it at the end to make indices simpler.
r=range
n=(int)(input())
def R(A,I):
 l=I%n;w=I//n
 if I==n*n:[print(A[i*n:i*n+n])for i in r(n)];exit()
 for K in r(n):
  if all([all([A[i*n+l]!=K,w!=l or A[i+n*i]!=K,w!=n-1-l or A[n*i+n-i-1]!=K])for i in r(w)]+[A[w*n+i]!=K for i in r(l)]):R(A+[K],I+1)
R([],0)

Ungolfed version:
def Recurse(A,I,n):
 column=I%n
 row=I//n
 if I==n*n:
     [print(*A[i*n:i*n+n])for i in range(n)] # output
     exit() #end recursion
 for K in range(n):
    # try every possibility. Test if they satisfy the constraints:
    # if so, move the index on. If none of them do, we'll return None.
    # if a child returns None, we'll move onto the next potential child:
    # if all of them fail it will backtrack to the next level.
    if all([
        all([
            A[i*n+column]!=K, # column constraint
            row!=column or A[i+n*i]!=K, # diagonal constraint
            row!=n-1-column or A[n*i+n-i-1]!=K # antidiagonal constraint
            ]) for i in range(row)
        ]+[
            A[row*n+i]!=K for i in range(column) # row constraint
            ]):
        Recurse(A+[K],I+1,n)

Recurse([],0,(int)(input()))

Funciton, non-competitive
UPDATE! Massive performance improvement! n = 7 now completes in under 10 minutes! See explanation at bottom!
This was good fun to write. This is a brute-force solver for this problem written in Funciton. Some factoids:

It accepts an integer on STDIN. Any extraneous whitespace breaks it, including a newline after the integer.
It uses the numbers 0 to n − 1 (not 1 to n).
It fills the grid “backwards”, so you get a solution where the bottom row reads 3 2 1 0 rather than where the top row reads 0 1 2 3.
It correctly outputs 0 (the only solution) for n = 1.
Empty output for n = 2 and n = 3.
When compiled to an exe, takes about 8¼ minutes for n = 7 (was about one hour before the performance improvement). Without compiling (using the interpreter) it takes about 1.5 times as long, so using the compiler is worth it.
As a personal milestone, this is the first time I wrote a whole Funciton program without first writing the program in a pseudocode language. I did write it in actual C# first though.
(However, this is not the first time I made a change to massively improve the performance of something in Funciton. The first time I did that was in the factorial function. Swapping the order of the operands of the multiplication made a huge difference because of how the multiplication algorithm works. Just in case you were curious.)

Without further ado:
            ┌────────────────────────────────────┐           ┌─────────────────┐
            │                                  ┌─┴─╖ ╓───╖ ┌─┴─╖   ┌──────┐    │
            │                    ┌─────────────┤ · ╟─╢ Ӂ ╟─┤ · ╟───┤      │    │
            │                    │             ╘═╤═╝ ╙─┬─╜ ╘═╤═╝ ┌─┴─╖    │    │
            │                    │               └─────┴─────┘   │ ♯ ║    │    │
            │                  ┌─┴─╖                             ╘═╤═╝    │    │
            │     ┌────────────┤ · ╟───────────────────────────────┴───┐  │    │
          ┌─┴─╖ ┌─┴─╖   ┌────╖ ╘═╤═╝ ┌──────────┐         ┌────────┐ ┌─┴─╖│    │
          │ ♭ ║ │ × ╟───┤ >> ╟───┴───┘        ┌─┴─╖       │ ┌────╖ └─┤ · ╟┴┐   │
          ╘═╤═╝ ╘═╤═╝   ╘══╤═╝          ┌─────┤ · ╟───────┴─┤ << ╟─┐ ╘═╤═╝ │   │
    ┌───────┴─────┘ ┌────╖ │            │     ╘═╤═╝         ╘══╤═╝ │   │   │   │
    │     ┌─────────┤ >> ╟─┘            │       └───────┐      │   │   │   │   │
    │     │         ╘══╤═╝            ┌─┴─╖   ╔═══╗   ┌─┴─╖ ┌┐ │   │ ┌─┴─╖ │   │
    │     │           ┌┴┐     ┌───────┤ ♫ ║ ┌─╢ 0 ║ ┌─┤ · ╟─┤├─┤   ├─┤ Ӝ ║ │   │
    │     │   ╔═══╗   └┬┘     │       ╘═╤═╝ │ ╚═╤═╝ │ ╘═╤═╝ └┘ │   │ ╘═╤═╝ │   │
    │     │   ║ 1 ╟───┬┘    ┌─┴─╖       └───┘ ┌─┴─╖ │   │      │   │   │ ┌─┴─╖ │
    │     │   ╚═══╝ ┌─┴─╖   │ ɓ ╟─────────────┤ ? ╟─┘   │    ┌─┴─╖ │   ├─┤ · ╟─┴─┐
    │     ├─────────┤ · ╟─┐ ╘═╤═╝             ╘═╤═╝   ┌─┴────┤ + ╟─┘   │ ╘═╤═╝   │
  ┌─┴─╖ ┌─┴─╖       ╘═╤═╝ │ ╔═╧═╕ ╔═══╗ ┌───╖ ┌─┴─╖ ┌─┴─╖    ╘═══╝     │   │     │
┌─┤ · ╟─┤ · ╟───┐     └┐  └─╢   ├─╢ 0 ╟─┤ ⌑ ╟─┤ ? ╟─┤ · ╟──────────────┘   │     │
│ ╘═╤═╝ ╘═╤═╝   └───┐ ┌┴┐   ╚═╤═╛ ╚═╤═╝ ╘═══╝ ╘═╤═╝ ╘═╤═╝                  │     │
│   │   ┌─┴─╖ ┌───╖ │ └┬┘   ┌─┴─╖ ┌─┘           │     │                    │     │
│ ┌─┴───┤ · ╟─┤ Җ ╟─┘  └────┤ ? ╟─┴─┐   ┌─────────────┘                    │     │
│ │     ╘═╤═╝ ╘═╤═╝         ╘═╤═╝   │   │╔════╗╔════╗                      │     │
│ │       │  ┌──┴─╖ ┌┐   ┌┐ ┌─┴─╖ ┌─┴─╖ │║ 10 ║║ 32 ║    ┌─────────────────┘     │
│ │       │  │ << ╟─┤├─┬─┤├─┤ · ╟─┤ · ╟─┘╚══╤═╝╚╤═══╝ ┌──┴──┐                    │
│ │       │  ╘══╤═╝ └┘ │ └┘ ╘═╤═╝ ╘═╤═╝     │ ┌─┴─╖ ┌─┴─╖ ┌─┴─╖                  │
│ │     ┌─┴─╖ ┌─┴─╖  ┌─┴─╖  ┌─┴─╖ ╔═╧═╕     └─┤ ? ╟─┤ · ╟─┤ % ║                  │
│ └─────┤ · ╟─┤ · ╟──┤ Ӂ ╟──┤ ɱ ╟─╢   ├───┐   ╘═╤═╝ ╘═╤═╝ ╘═╤═╝                  │
│       ╘═╤═╝ ╘═╤═╝  ╘═╤═╝  ╘═══╝ ╚═╤═╛ ┌─┴─╖ ┌─┴─╖   │     └────────────────────┘
│         └─────┤      │            └───┤ ‼ ╟─┤ ‼ ║   │        ┌──────┐
│               │      │                ╘═══╝ ╘═╤═╝   │        │ ┌────┴────╖
│               │      │                      ┌─┴─╖   │        │ │ str→int ║
│               │      └──────────────────────┤ · ╟───┴─┐      │ ╘════╤════╝
│               │          ┌─────────╖        ╘═╤═╝     │    ╔═╧═╗ ┌──┴──┐
│               └──────────┤ int→str ╟──────────┘       │    ║   ║ │ ┌───┴───┐
│                          ╘═════════╝                  │    ╚═══╝ │ │ ┌───╖ │
└───────────────────────────────────────────────────────┘          │ └─┤ × ╟─┘
           ┌──────────────┐                                  ╔═══╗ │   ╘═╤═╝
╔════╗     │ ╓───╖ ┌───╖  │                              ┌───╢ 0 ║ │   ┌─┴─╖ ╔═══╗
║ −1 ║     └─╢ Ӝ ╟─┤ × ╟──┴──────┐                       │   ╚═╤═╝ └───┤ Ӂ ╟─╢ 0 ║
╚═╤══╝       ╙───╜ ╘═╤═╝         │                       │   ┌─┴─╖     ╘═╤═╝ ╚═══╝
┌─┴──╖ ┌┐ ┌───╖ ┌┐ ┌─┴──╖ ╔════╗ │                       │ ┌─┤   ╟───────┴───────┐
│ << ╟─┤├─┤ ÷ ╟─┤├─┤ << ║ ║ −1 ║ │                       │ │ └─┬─╜ ┌─┐ ┌─────┐   │
╘═╤══╝ └┘ ╘═╤═╝ └┘ ╘═╤══╝ ╚═╤══╝ │                       │ │   └───┴─┘ │   ┌─┴─╖ │
  │         └─┘      └──────┘    │                       │ └───────────┘ ┌─┤ ? ╟─┘
  └──────────────────────────────┘         ╓───╖         └───────────────┘ ╘═╤═╝
                               ┌───────────╢ Җ ╟────────────┐                │
      ┌────────────────────────┴───┐       ╙───╜            │
      │                          ┌─┴────────────────────┐ ┌─┴─╖
    ┌─┴─╖                      ┌─┴─╖                  ┌─┴─┤ · ╟──────────────────┐
    │ ♯ ║ ┌────────────────────┤ · ╟───────┐          │   ╘═╤═╝                  │
    ╘═╤═╝ │                    ╘═╤═╝       │          │     │              ┌───╖ │
┌─────┴───┘    ┌─────────────────┴─┐   ┌───┴───┐    ┌─┴─╖ ┌─┴─╖          ┌─┤ × ╟─┴─┐
│              │                 ┌─┴─╖ │   ┌───┴────┤ · ╟─┤ · ╟──────────┤ ╘═╤═╝   │
│              │ ┌───╖ ┌───╖  ┌──┤ · ╟─┘ ┌─┴─┐      ╘═╤═╝ ╘═╤═╝        ┌─┴─╖ │     │
│         ┌────┴─┤ ♭ ╟─┤ × ╟──┘  ╘═╤═╝   │ ┌─┴─╖ ┌───╖└┐ ┌──┴─╖      ┌─┤ · ╟─┘     │
│         │      ╘═══╝ ╘═╤═╝ ┌───╖ │     │ │ × ╟─┤ Ӝ ╟─┴─┤ ÷% ╟─┐    │ ╘═╤═╝ ┌───╖ │
│   ┌─────┴───┐     ┌────┴───┤ Ӝ ╟─┴─┐   │ ╘═╤═╝ ╘═╤═╝   ╘══╤═╝ │    │   └───┤ Ӝ ╟─┘
│ ┌─┴─╖ ┌───╖ │     │ ┌────╖ ╘═╤═╝   │   └───┘   ┌─┴─╖      │   │    └────┐  ╘═╤═╝
│ │ × ╟─┤ Ӝ ╟─┘     └─┤ << ╟───┘   ┌─┴─╖ ┌───────┤ · ╟───┐  │ ┌─┴─╖ ┌───╖ │    │
│ ╘═╤═╝ ╘═╤═╝         ╘══╤═╝   ┌───┤ + ║ │       ╘═╤═╝   ├──┴─┤ · ╟─┤ × ╟─┘    │
└───┤     └────┐ ╔═══╗ ┌─┴─╖ ┌─┴─╖ ╘═╤═╝ │ ╔═══╗ ┌─┴─╖ ┌─┴─╖  ╘═╤═╝ ╘═╤═╝      │
  ┌─┴─╖ ┌────╖ │ ║ 0 ╟─┤ ? ╟─┤ = ║  ┌┴┐  │ ║ 0 ╟─┤ ? ╟─┤ = ║    │     │ ┌────╖ │
  │ × ╟─┤ << ╟─┘ ╚═══╝ ╘═╤═╝ ╘═╤═╝  └┬┘  │ ╚═══╝ ╘═╤═╝ ╘═╤═╝    │     └─┤ << ╟─┘
  ╘═╤═╝ ╘═╤══╝ ┌┐     ┌┐ │     │     └───┘       ┌─┴─╖   ├──────┘       ╘═╤══╝
    │     └────┤├──┬──┤├─┘     ├─────────────────┤ · ╟───┘                │
    │          └┘┌─┴─╖└┘       │     ┌┐   ┌┐     ╘═╤═╝ ┌┐   ┌┐            │
    └────────────┤ · ╟─────────┘   ┌─┤├─┬─┤├─┐     └───┤├─┬─┤├────────────┘
                 ╘═╤═╝             │ └┘ │ └┘ │         └┘ │ └┘
                   └───────────────┘    │    └────────────┘

Explanation of the first version
The first version took about an hour to solve n = 7. The following explains mostly how this slow version worked. At the bottom I will explain what change I made to get it to under 10 minutes.
An excursion into bits
This program needs bits. It needs lots of bits, and it needs them in all the right places. Experienced Funciton programmers already know that if you need n bits, you can use the formula

which in Funciton can be expressed as

When doing my performance optimization, it occurred to me that I can calculate the same value much faster using this formula:

I hope you’ll forgive me that I didn’t update all the equation graphics in this post accordingly.
Now, let’s say you don’t want a contiguous block of bits; in fact, you want n bits at regular intervals every k-th bit, like so:
                                 LSB
                                  ↓
00000010000001000000100000010000001
                            └──┬──┘
                               k

The formula for this is fairly straight-forward once you know it:

In the code, the function Ӝ takes values n and k and calculates this formula.
Keeping track of used numbers
There are n² numbers in the final grid, and each number can be any of n possible values. In order to keep track of which numbers are permitted in each cell, we maintain a number consisting of n³ bits, in which a bit is set to indicate that a particular value is taken. Initially this number is 0, obviously.
The algorithm begins in the bottom-right corner. After “guessing” the first number is a 0, we need to keep track of the fact that the 0 is no longer permitted in any cell along the same row, column and diagonal:
LSB                               (example n=5)
 ↓
 10000 00000 00000 00000 10000
 00000 10000 00000 00000 10000
 00000 00000 10000 00000 10000
 00000 00000 00000 10000 10000
 10000 10000 10000 10000 10000
                             ↑
                            MSB

To this end, we calculate the following four values:

Current row: We need n bits every n-th bit (one per cell), and then shift it to the current row r, remembering every row contains n² bits:

Current column: We need n bits every n²-th bit (one per row), and then shift it to the current column c, remembering every column contains n bits:

Forward diagonal: We need n bits every... (did you pay attention? Quick, figure it out!)... n(n+1)-th bit (well done!), but only if we’re actually on the forward diagonal:

Backward diagonal: Two things here. First, how do we know if we’re on the backward diagonal? Mathematically, the condition is c = (n − 1) − r, which is the same as c = n + (−r − 1). Hey, does that remind you of something? That’s right, it’s two’s complement, so we can use bitwise negation (very efficient in Funciton) instead of the decrement. Second, the formula above assumes that we want the least significant bit to be set, but in the backward diagonal we don’t, so we have to shift it up by... do you know?... That’s right, n(n − 1).

This is also the only one where we potentially divide by 0 if n = 1. However, Funciton doesn’t care. 0 ÷ 0 is just 0, don’t you know?

In the code, the function Җ (the bottom one) takes n and an index (from which it calculates r and c by division and remainder), calculates these four values and ors them together.
The brute-force algorithm
The brute-force algorithm is implemented by Ӂ (the function at the top). It takes n (the grid size), index (where in the grid we’re currently placing a number), and taken (the number with n³ bits telling us which numbers we can still place in each cell).
This function returns a sequence of strings. Each string is a full solution to the grid. It’s a complete solver; it would return all solutions if you let it, but it returns them as a lazy-evaluated sequence.

If index has reached 0, we’ve successfully filled the whole grid, so we return a sequence containing the empty string (a single solution that covers none of the cells). The empty string is 0, and we use the library function ⌑ to turn that into a single-element sequence.
The check described under performance improvement below happens here.
If index has not yet reached 0, we decrement it by 1 to get the index at which we now need to place a number (call that ix).
We use ♫ to generate a lazy sequence containing the values from 0 to n − 1.
Then we use ɓ (monadic bind) with a lambda that does the following in order:

First look at the relevant bit in taken to decide whether the number is valid here or not. We can place a number i if and only if taken & (1 << (n × ix) << i) isn’t already set. If it is set, return 0 (empty sequence).
Use Җ to calculate the bits corresponding to the current row, column and diagonal(s). Shift it by i and then or it onto taken.
Recursively call Ӂ to retrieve all solutions for the remaining cells, passing it the new taken and the decremented ix. This returns a sequence of incomplete strings; each string has ix characters (the grid filled in up to index ix).
Use ɱ (map) to go through the solutions thusly found and use ‼ to concatenate i to the end of each. Append a newline if index is a multiple of n, otherwise a space.

Generating the result
The main program calls Ӂ (the brute forcer) with n, index = n² (remember we fill the grid backwards) and taken = 0 (initially nothing is taken). If the result of this is an empty sequence (no solution found), output the empty string. Otherwise, output the first string in the sequence. Note that this means it will evaluate only the first element of the sequence, which is why the solver doesn’t continue until it has found all solutions.
Performance improvement
(For those who already read the old version of the explanation: the program no longer generates a sequence of sequences that needs to be separately turned into a string for output; it just generates a sequence of strings directly. I’ve edited the explanation accordingly. But that wasn’t the main improvement. Here it comes.)
On my machine, the compiled exe of the first version took pretty much exactly 1 hour to solve n = 7. This was not within the given time limit of 10 minutes, so I didn’t rest. (Well, actually, the reason I didn’t rest was because I had this idea on how to massively speed it up.)
The algorithm as described above stops its search and backtracks every time that it encounters a cell in which all the bits in the taken number are set, indicating that nothing can be put into this cell.
However, the algorithm will continue to futilely fill the grid up to the cell in which all those bits are set. It would be much faster if it could stop as soon as any yet-to-be-filled-in cell already has all the bits set, which already indicates that we can never solve the rest of the grid no matter what numbers we put in it. But how do you efficiently check whether any cell has its n bits set without going through all of them?
The trick starts by adding a single bit per cell to the taken number. Instead of what was shown above, it now looks like this:
LSB                               (example n=5)
 ↓
 10000 0 00000 0 00000 0 00000 0 10000 0
 00000 0 10000 0 00000 0 00000 0 10000 0
 00000 0 00000 0 10000 0 00000 0 10000 0
 00000 0 00000 0 00000 0 10000 0 10000 0
 10000 0 10000 0 10000 0 10000 0 10000 0
                                       ↑
                                      MSB

Instead of n³, there are now n²(n + 1) bits in this number. The function that populates the current row/column/diagonal has been changed accordingly (actually, completely rewritten to be honest). That function will still populate only n bits per cell though, so the extra bit we just added will always be 0.
Now, let’s say we are halfway through the calculation, we just placed a 1 in the middle cell, and the taken number looks something like this:
                 current
LSB              column           (example n=5)
 ↓                 ↓
 11111 0 10010 0 01101 0 11100 0 11101 0
 00011 0 11110 0 01101 0 11101 0 11100 0
 11111 0 11110 0[11101 0]11100 0 11100 0    ← current row
 11111 0 11111 0 11111 0 11111 0 11111 0
 11111 0 11111 0 11111 0 11111 0 11111 0
                                       ↑
                                      MSB

As you can see, the top-left cell (index 0) and the middle-left cell (index 10) are now impossible. How do we most efficiently determine this?
Consider a number in which the 0th bit of each cell is set, but only up to the current index. Such a number is easy to calculate using the familiar formula:

What would we get if we added these two numbers together?
LSB                                               LSB
 ↓                                                 ↓
 11111 0 10010 0 01101 0 11100 0 11101 0           10000 0 10000 0 10000 0 10000 0 10000 0        ╓───╖
 00011 0 11110 0 01101 0 11101 0 11100 0     ║     10000 0 10000 0 10000 0 10000 0 10000 0            ║
 11111 0 11110 0 11101 0 11100 0 11100 0  ═══╬═══  10000 0 10000 0 00000 0 00000 0 00000 0  ═════   ╓─╜
 11111 0 11111 0 11111 0 11111 0 11111 0     ║     00000 0 00000 0 00000 0 00000 0 00000 0  ═════   ╨
 11111 0 11111 0 11111 0 11111 0 11111 0           00000 0 00000 0 00000 0 00000 0 00000 0          o
                                       ↑                                                 ↑
                                      MSB                                               MSB

The result is:
             OMG
              ↓
        00000[1]01010 0 11101 0 00010 0 00011 0
        10011 0 00001 0 11101 0 00011 0 00010 0
═════   00000[1]00001 0 00011 0 11100 0 11100 0
═════   11111 0 11111 0 11111 0 11111 0 11111 0
        11111 0 11111 0 11111 0 11111 0 11111 0

As you can see, the addition overflows into the extra bit that we added, but only if all the bits for that cell are set! Therefore, all that’s left to do is to mask out those bits (same formula as above, but << n) and check if the result is 0:
00000[1]01010 0 11101 0 00010 0 00011 0    ╓╖    00000 1 00000 1 00000 1 00000 1 00000 1         ╓─╖ ╓───╖
10011 0 00001 0 11101 0 00011 0 00010 0   ╓╜╙╖   00000 1 00000 1 00000 1 00000 1 00000 1        ╓╜ ╙╖    ║
00000[1]00001 0 00011 0 11100 0 11100 0   ╙╥╥╜   00000 1 00000 1 00000 0 00000 0 00000 0  ═════ ║   ║  ╓─╜
11111 0 11111 0 11111 0 11111 0 11111 0   ╓╜╙╥╜  00000 0 00000 0 00000 0 00000 0 00000 0  ═════ ╙╖ ╓╜  ╨
11111 0 11111 0 11111 0 11111 0 11111 0   ╙──╨─  00000 0 00000 0 00000 0 00000 0 00000 0         ╙─╜   o

If it is not zero, the grid is impossible and we can stop.

Screenshot showing solution and running time for n = 4 to 7.

HOLY FUCK. Dude, that's impressive.

I second @Deusovi's comment, thank you for putting so much effort into this

Haskell, 790*0.80=632 bytes
import Data.List
import Control.Monad
import Data.Array
s r=let{h as bs=[(a,b)|a<-as,b<-bs];(&)m k=(\(Just x)->x)$lookup k m;j=Just;n=Nothing;c=[1..r];q=delete;u=h[1..r]c;o=[(s,[u |u<-[h[1..r][c]|c<-c]++[h[r]c|r<-[1..r]]++[zip[1..r][1..r],zip[1..r][r,r-1..1]],s`elem`u])|s<-u];k=foldr(>=>)j;a p d g0=k[t p d2|d2<-q d(g0!p)]g0;t p d g0|not(d`elem`(g0!p))=j g0|[]<-v=n|[d2]<-v=k[t s2 d2|s2<-[(s,delete s$nub(concat(o&s)))|s<-u]&p]g1|True=k[l[s|s<-u,not(d`elem`v)]|u<-o&p]g1 where{v=q d(g0!p);g1=g0//[(p,v)];l[]_=n;l[d3]g=a d3 d g;l _ r=j r};w g0|and[case g0!s of{[_]->True;_->False}|s<-u]=j g0|True=msum[a s' d g0>>=w|d<-g0!s']where(_,s')=minimumBy(\(a,_)(b,_)->compare a b)[(l,s)|s<-u,let v=g0!s;l=length v,l>1]}in fmap(fmap(\[x]->x))$w$array((1,1),(r,r))[((i,j),[1..r])|i<-[1..r],j<-[1..r]]

I noticed this problem is very similar to sudoku. I remember an old sudoku solver I wrote in Haskell based on this other one in Python. This is my first code golf post or attempt.
This fulfills the bonus because it returns Nothing for n=2,3 and Just <result> for n>=4, where <result> is a 2D array of integral values.
See here for online interpreter. That code is actually longer than the one in the post because the online interpreter has more strict requirements as to what forms a complete program (rules say a submission can be a function). This submission takes input as a function argument.

A few quick tips: a) you define c=[1..r], so you can use it within o and w. b) minimumBy(\(a,_)(b,_)->compare a b)[...] is head$sortOn fst[...]. c) the v in v=g0!s is only used once, so don't define it at all: l=length$g0!s. d) you still have some two letter parameter names. e) replace True with 1<2 and False with 2<1. f) and[case g0!s of{[_]->True;_->False}|s<-u] is all((==1).length.(g0!))u.

Quick tips, part II: g) (&)m k= can be defined infix: m&k=. h) not(delem(g0!p)) is notElem d$g0!p. i) concat(...) is id=<<(...). j) use an infix operator for h, e.g. as%bs=.

Quick meta tips: you can delimit code that has backticks in it correctly using double backticks ``like`this``!

Pyth, 41 bytes
#Km.SQQI.AmqQl{d+.TK.Tm,@@Kdd@@Kt-QddQB;K

#                                      ;   # while(True)
 Km.SQQ                                    # K = random QxQ 2d list
       I                               ;   # if ...
        .A                                 # all of...
          m                          Q     # map(range(Q))...
                +                          # concat
                 .TK                       # transpose K
                    .Tm,@@Kdd@@Kt-Qdd      # diagonals of K
                      m             d      # map(range(d))
                       ,                   # 2-elem list of...
                        @@Kdd              # K[n][n]
                             @@Kt-Qd       # and K[len(K)-n-1][n]
                    .T                     # transpose
           qQl{d                           # subarrays have no dups...
                                      B;   # ... then, break
                                        K  # output final result

Brute force ftw!
Since this basically keeps trying random shuffles until it works (well, it keeps trying n * [shuffle(range(n))]), it takes a really, really long time. Here are some test runs to give you an idea of how long it takes:
llama@llama:~$ time echo 4 | pyth <(echo '#Km.SQQI.AmqQl{d+.TK.Tm,@@Kdd@@Kt-QddQB;K')
[[2, 1, 0, 3], [0, 3, 2, 1], [3, 0, 1, 2], [1, 2, 3, 0]]
echo 4  0.00s user 0.00s system 0% cpu 0.001 total
pyth <(echo '#Km.SQQI.AmqQl{d+.TK.Tm,@@Kdd@@Kt-QddQB;K')  0.38s user 0.00s system 96% cpu 0.397 total

That's only 4x4, and it runs in a little under half a second. I'm actually cheating because this is the best out of a few trials—most of them take over a second or two.
I've yet to get a timing on 5x5 (it ran to completion once, but that was in a REPL and I wasn't timing it).
Note that the rule for the time limit was only edited into the question after this answer was posted.

I suppose this can't do 7x7 within ten minutes? ^^

@Mauris Well, sometimes it can... ;) Is that a requirement I missed? I don't see anything mentioning a time limit in the question.

I see it in the comments, (not new comment, 12 hours ago)

Sorry about that, I didn't think of it until someone mentioned it, I'll edit the challenge now

+1 for the abstract ASCII art in your commented version. :)

qQl{d == {Id ({Id means that d is invariant under {)

SWI-Prolog, 326*0.80 = 260.8 bytes
:-use_module(library(clpfd)).
a(N):-l(N,R),m(l(N),R),append(R,V),V ins 1..N,transpose(R,C),d(0,R,D),maplist(reverse,R,S),d(0,S,E),m(m(all_distinct),[R,C,[D,E]]),m(label,R),m(p,R).
l(L,M):-length(M,L).
d(X,[H|R],[A|Z]):-nth0(X,H,A),Y is X+1,(R=[],Z=R;d(Y,R,Z)).
p([H|T]):-write(H),T=[],nl;write(' '),p(T).
m(A,B):-maplist(A,B).

Edit: saved 16 bytes thanks to @Mat
Usage
Call a(5). in your interpreter for N=5. This returns false for N=2 or N=3.
Since it uses the CLPFD library this is not pure bruteforce. This program can find a solution for N=20 in about 15 seconds on my computer.
Ungolfed + explanations:
This basically works like a Sudoku solver, except that the blocks constraints are replaced with the diagonals constraints.
:-use_module(library(clpfd)).      % Import Constraints library

a(N):-
    l(N,R),                        % R is a list of length N
    maplist(l(N),R),               % R contains sublists, each of length N
    append(R,V),
    V ins 1..N,                    % Each value in the matrix is between 1 and N
    maplist(all_distinct,R),       % Values must be different on each row
    transpose(R,C),
    maplist(all_distinct,C),       % Values must be different on each column
    d(0,R,D),
    maplist(reverse,R,S),
    d(0,S,E),
    all_distinct(D),               % Values must be different on the diagonal
    all_distinct(E),               % Values must be different on the "anti"-diagonal
    maplist(label,R),              % Affects actual values to each element
    maplist(p,R).                  % Prints each row

l(L,M):-length(M,L).               % True if L is the length of M

d(X,[H|R],[A|Z]):-nth0(X,H,A),Y is X+1,(R=[],Z=R;d(Y,R,Z)). % True if the third argument is the diagonal of the second argument

p([H|T]):-write(H),T=[],nl;write(' '),p(T).  % Prints a row separated by spaces and followed by a new line

Very nice! You can save a bytes with: maplist(maplist(all_distinct), [R,C,D,E])

@mat Thanks for the suggestion, saves 16 bytes. I need to use [R,C,[D,E]] though, because E and D are simple lists.

Right, very nice workaround!

@Fatalize Just to let you know, your solution was the most impressive as it is the only one that go solve N=20

@Zequ Thanks! But that's mostly due to the amazing CLPFD library of Prolog, which does the heavy lifting in problems like these :)

@Fatalize it sounds interesting, I'll read about it

CJam, 87 bytes - 20% bonus = 69.6 bytes
qi__"@I/l
ŤˏūȻ
܀ᅀ൹৽჈͚
㑢鴑慚菥洠㬝᚜
"N/=:i0+\,m!f=`1LL](4e<=

Hardcodes the answers. Contains some unprintables. Works for N = 1 through N = 8.
Basically, each line in that mysterious string contains indices into the list of permutations of range(N), encoded as Unicode characters.
=:i0+\,m!f= indexes into the list of permutations, adding a 0 to the end of the list of indices first, representing the bottom row 0 1 2 ... N-1. For N < 4, the resulting 2D array is nonsense.
`1LL] creates a list [N, pretty output, 1, "", ""]. Then, (4e<= pops the first element out of this list, N, and retrieves the min(N, 4) % 4th element from the rest of it. For N >= 4, that's the output, and otherwise it's the special-case outputs for the first three cases.
Try it here.

C++, 672*0.80 645*0.80 = 516 bytes
#include <iostream>
int **b,**x,**y,*d,*a,n;
#define R(i) for(i=0;i<n;i++){
#define E(e) e=new int[n];
int f(int c,int r) {int i=0,p=c-1;if(r>=n)return 1;if(c == n + 1)return f(1,r+1);R(i)int m=r==i,s=r+i==n-1;if(!b[r][i]&&!x[r][p]&&!(m&&d[p])&&!(s&&a[p])&&!y[i][p]){b[r][i]=c;x[r][p]=1;y[i][p]=1;if(m)d[p]=1;if(s)a[p]=1;if(f(c+1,r))return 1;b[r][i]=0;x[r][p]=0;y[i][p]=0;if(m)d[p]=0;if(s)a[p]=0;}}return 0;}
int main(){std::cin>>n;int i=0,j=0;b=new int*[n];x=new int*[n];y=new int*[n];E(d);E(a);R(i)E(b[i]);E(x[i]);E(y[i]); d[i]=0;a[i]=0;R(j)b[i][j]=0;x[i][j]=0;y[i][j]=0;}}if(f(1,0)){R(i)R(j)std::cout<<b[i][j];}std::cout<<std::endl;}}}

Try it online here
Since a couple answers have already been posted, I thought I would post the golfed version of the code I used to generated the output for the examples. This is my first time answering a code-golf, so all feedback is welcomed. :)
Ungolfed + explanations:
Essentially, the code is brute-forcing a solution. It starts in the first row, with 0. It starts in the first spot, if that spots passes all the checks, it moves onto to the next number. If it fills the row, it moves onto the next row. If it's done all of the rows, that means a solution has been found. If the spot doesn't pass all of the checks, it moves onto the next spot. If it's done the row, then it backtracks, as a number in one of the previous rows prevents a solution from being possible.
#include <iostream>

// global variables to save bytes on passing these are function arguments
int **b, // this will store the state of the board
    **x, // if x[i][j] is true, row i of b contains the number j
    **y, // if y[i][j] is true, column i of b contains the number j
    *d,  // if d[i] the main diagonal of b contains i
    *a,  // if a[i] the antidiagonal of a contains i
    n;

// preprocessor to save bytes on repeated statements
#define R(i) for(i=0;i<n;i++){
#define E(e) e=new int[n];

// Recursively looks for a solution
// c - the current number to insert in row r
// r - the current row to fill
int f (int c, int r) {
        int i=0,p=c-1;
        if (r >= n) return 1;             // we are done
        if (c == n + 1) return f(1,r+1);  // this row is full, move to the next row
        R(i)                              // go through the positions in this row,
                                                                            // trying to fill them with c
                int m=r==i, s=r+i==n-1;   // check if this position (r,i) is on ones
                                                                            // of the diagonals
                // if this spot isn't filled, and the row (r), column (i) and diagonals
                // (if it's on the diagonal) doesn't contain the number, fill the spot
                if (!b[r][i] && !x[r][p] && !(m&&d[p]) && !(s&&a[p]) && !y[i][p]) {
                        // fill the spot, and indicate that this row, column and diagonals
                        // contain this number, c
                        b[r][i]=c; x[r][p]=1; y[i][p]=1;
                        if (m) d[p]=1; if (s)a[p]=1;

                        // move onto to the next number, if you find a solution, stop
                        if (f(c+1,r)) return 1;

                        // with this number in this spot, a solution is impossible, clear
                        // its, and clear the checks
                        b[r][i]=0; x[r][p]=0; y[i][p]=0;
                        if (m) d[p]=0; if (s) a[p]=0;
                }
        }

        return 0; // a solution wasn't found
}

int main() {
        std::cin >> n; // get n from STDIN

        // initialization
        int i=0,j=0;
        b=new int*[n]; x=new int*[n]; y=new int*[n];
        E(d); E(a);
        R(i)
                E(b[i]); E(x[i]); E(y[i]); // initialization the inner arrays of b, x, y
                d[i]=0; a[i]=0;

                R(j)
                        b[i][j]=0; x[i][j]=0; y[i][j]=0; // ensure each point is initialized as 0
                }
        }

        // find a solution starting at the top-left corner and print it if it finds one
        if (f(1,0)) {
                R(i)
                        R(j)
                                std::cout<<b[i][j];
                        }
                        std::cout<<std::endl;
                }
        }
}

After rereading the code, I realized some of the checks may not be necessary, such as the if (x[r][p]) return f(c+1,r);. I'm working on shortening it.

Clojure, (215 + 258) * 0.8 = 378.4 (174 + 255) * 0.8 = 343.2
Split into two parts: error counting S and an anonymous function which does the actual optimization via Tabu search.
Update: shorter S (counts distinct values within groups), less optimal starting state (no shuffle).
(defn S[I n](count(mapcat set(vals(apply merge-with concat(flatten(for[R[(range n)]i R j R v[[(I(+(* n i)j))]]][{[1 i]v}{[2 j]v}(if(= i j){3 v})(if(=(- n 1 i)j){4 v})])))))))
#(if-let[s({1[0]2()3()}%)]s(loop[I(vec(for[R[(range %)]i R j R]i))P #{}](let[[s I](last(sort-by first(for[R[(range(count I))]i R j R I[(assoc(assoc I i(I j))j(I i))]:when(not(P I))][(S I %)I])))](if(=(*(+(* % 2)2)%)s)(partition % I)(recur I(conj P I))))))

Single core benchmarks (in milliseconds) for 4, 5, 6 and 7 run 3 times:
[[  131.855337   132.96267    138.745981]
 [ 1069.187325  1071.189488  1077.339372]
 [ 9114.736987  9206.65368   9322.656693]
 [36546.309408 36836.567267 36928.346312]]

Original:
(defn S[I n](apply +(flatten(for[p(concat(partition n I)(for[p(apply map vector(partition n(range(count I))))](map I p))[(take-nth(inc n)I)][(rest(butlast(take-nth(dec n)I)))])](remove #{1}(vals(frequencies p)))))))
#(if-let[s({1[0]2()3()}%)]s(loop[I(vec(flatten(map shuffle(repeat %(range %)))))P #{}](let[[s I](first(sort-by first(for[R[(range(count I))]i R j R I[(assoc(assoc I i(I j))j(I i))]:when(not(P I))][(S I %)I])))](if(= s 0)(partition % I)(recur I(conj P I))))))

I wish S was shorter, but because it only counts occurrences of more than one / partition the stopping criterion is simple (= s 0).
Many CPU cycles are wasted for non-useful swaps, for example it doesn't improve the score if you swap 2 with 2, and you don't need to swap numbers between rows as they all have distinct values to begin with.
Benchmarks with Intel 6700K (in milliseconds):
(defn S[I n]( ... )
(def F #( ... ))

(defmacro mytime[expr]
  `(let [start# (. System (nanoTime)) ret# ~expr]
     (/ (double (- (. System (nanoTime)) start#)) 1000000.0)))

(pprint(vec(for[n[4 5 6 7]](vec(sort(repeatedly 5 #(mytime (F n)))))))

[[  43.445902   45.895107   47.277399   57.681634    62.594037]
 [ 222.964582  225.467034  240.532683  330.237721   593.686911]
 [2285.417473 2531.331068 3002.597908 6361.591714  8331.809410]
 [3569.62372  4779.062486 5725.905756 7444.941763 14120.796615]]

Multithreaded with pmap:
[[   8.881905  16.343714   18.87262  18.9717890   22.194430]
 [  90.963870 109.719332  163.00299  245.824443  385.365561]
 [ 355.872233 356.439256 1534.31059 2593.482767 3664.221550]
 [1307.727115 1554.00260 2068.35932 3626.878526 4029.543011]]


text:
Have you been nice this year?
Introduction
Santa has too many names to process, and needs your help! He needs you to write a program or a function, which outputs nice, naughty, very naughty or very very naughty. To determine how nice or naughty someone is, Santa had developed an algorithm:
Nice (division, math):
First of all, we obtain a number from the name by adding all the letters up (spaces ignored). For example:
Doorknob =

D = 4
o = 15
o = 15
r = 18
k = 11
n = 14
o = 15
b = 2

4 + 15 + 15 + 18 + 11 + 14 + 15 + 2 = 94

If the number of divisors is equal to the length of the name, the person is considered nice. This means that your program should output [name] has been nice. Here, the divisors of 94 are:
Divisors of 94: 1, 2, 47, 94

There are 4 divisors, but the name has length 8 (spaces included). Conclusion, Doorknob has not been nice. So we continue our journey:

Naughty (sequence, math):
Santa has developed a new sequence, the christmas number. First, we will look at the following christmas trees:
n = 1        n = 2          n = 3          n = 4

                                             *
                                            ***
                                           *****
                                          *******
                                         *********
                          _   *             ***
                         |   ***           *****
                         |  *****         *******
               *         | *******       *********
  *           ***        |   ***            ***
 ***         *****   n*n |  *****          *****
  *           ***        | *******        *******
             *****       |   ***         *********
               *         |  *****           ***
                         |_*******         *****
                              *           *******
                           |_____|       *********
                             2n+1            *

  5            18             47             98

The amount of asterisks determines the christmas number. The sequence goes as following: 5, 18, 47, 98, 177, ....
From here, we can conclude that 94 is not a christmas number. That means that Doorknob has not just been naughty.

Very naughty (string):
For this, we need to find out if Doorknob is a raising ladder string. This is determined by the letters in the name with A = 1, B = 2, C = 3, etc.:
First we will look at the first letter, the D. This has value 4. This is our starting point. The next letter is o. This has the value 15, which is higher than our previous value, so we're going a step higher on the ladder. The next value is also an o. This is the same, so we're doing nothing. If the next value is higher than the current value, we will go a step higher. If the next value is lower than the current value, we will go a ster lower. If it's the same, we'll stay on the same step. This visualised for Doorknob, Martin Buttner and Alex A:
            O
           / \
      R   N   B
     / \ /
  O-O   K                 T   N   U                 L   X
 /                       / \ / \ / \               / \ / \
D                   M   R   I   B   T-T           A   E   A
                     \ /               \
                      A                 N   R
                                         \ /
                                          E

You can see that Doorknob ended higher than the starting position. So Doorknob has been very naughty. Martin Buttner and Alex A didn't get higher than the starting point. So they are both very very naughty.
Test cases
Input: Doorknob
Output: Doorknob has been very naughty

Input: Martin Buttner
Output: Martin Buttner has been very very naughty

Input: Jakube
Output: Jakube has been nice

Input: B
Output: B has been very very naughty

Rules

You need to provide a program or a function which takes input (which consists of at least one letter).
The input will consist of uppercase letters, lowercase letters and spaces. Spaces are ignored during the process, except for the length of the input.
This is code-golf, so the submission with the least amount of bytes wins!

Btw, the proper way to write Büttner without an umlaut is Buettner, not Buttner.

Any limit on input length?

The Christmas numbers are generated by n^3 + 2n^2 + 2, btw.

@Mauris, the length of the input will not exceed 99 characters.

Alrighty. Then the maximum "score" for a name is ZZZ...Z = 26 * 99 = 2574, meaning you only need to check Christmas numbers up to and including n=13. (Useful info for other golfers.)

@Mauris Yes, that is correct

My name change has made me go from being very very naughty to just being very naughty.

Santa has been very very naughty. Wait, what?

@Doorknob冰 - You didn't get his full name: Santa Claus has been very naughty.  Should also try Saint Nick, Saint Nicholas, St. Nick, St. Nicholas, Kris Kringle, Father Christmas, Pere Noel, and all his other aliases - maybe one of them will work?  Though why a "nice" guy should need so many aliases is already pretty suspect...

How are you determining the number of factors?  If a number has the same factor more than once, does that count?  (You could then have an infinite number of 1 factors.)  Or only unique factors?  Only unique prime factors?  I'm trying to figure out how Jakube passed as "nice" - the letters add up to 48, which has factors 1, 2, 3, 4, 6, 8, 12, 16, 24, 48, which is way more than the 6 letters in the name.  Or it could be 2, 2, 2, 2, 3, still not 6.  You could add a 1 to that, but you could also add four 1's to Doorknob and it would add up to 8 factors.  Need to clear that up a bit.

@DarrelHoffman The letters of Jakube add up to 50, not 48

D'oh.  Math error (had U as 19 instead of 21).  So it's unique factors (since there'd be two 5's otherwise), not necessarily prime.  Okay.

Pyth 86 bytes
Apparently I've been nice this year...
jd[z"has been"?qlzl{yPJsKxL+NG@Grz0"nice"+*"very "&!}Jm+*+2d*dd2SJhgs._M-VKtK0"naughty

Try it online: Demonstration or Test Suite
Explanation:
jd[z"has been"...      list with input string, "has been" and ...; join with spaces
qlzl{yPJsKxL+NG@Grz0   compares the length of input with the number of divisors
                       (computes all prime factors and counts the elements in the powerset)
?..."nice"             if True, use "nice" as last list element
                       else:
}Jm+*+2d*dd2SJ            check for christmas number
                          (checks, if its of the form n^3+2*n^2+2)
gs._M-VKtK0               check if raising ladder string ends lower or equal
                          (assigns each neighbor pair a number -1,0,1 and computes the sum)
&!...h...                 returns 0, 1 or 2
*"very "                  repeat "very " this times
+..."naughty              add "naughty" and use this as the third list element

CJam, 109 108 107 bytes
l" has been "1$[_,\S-:eu'@f-:A:+__,:)f%0e=@=\_{)__2+**))}%&A2ew::-:g1b0<]{}#4,="very "*_5>\"naughty""nice"?

Try it online.
Explanation
A full explanation will have to wait until later, but here is the code broken down into the different sections:
l" has been "1$[                    e# Some preparation...
  _,\S-:eu'@f-:A:+                  e# Determine letter sum.
  __,:)f%0e=@=                      e# Check divisor count.
  \_{)__2+**))}%&                   e# Check for Christmas number.
  A2ew::-:g1b0<                     e# Check ladder.
]{}#4,="very "*_5>\"naughty""nice"? e# Determine nice/naughtiness.

@RikerW I stole that from Doorknob's comment.

I +1'nd his comment too.

"Santa has been very very naughty"

MATL, 117 bytes
My longest MATL program so far :-) :-(
Uses current release of the language, which is earlier than this challenge.
jttk96-t0>)tstt:\~s4$bn=?xx'nice'}[1,2,0,2]99:ZQ=a?'naughty'}dt0>sw0<s-O>~'very naughty'w?'very 'wh]]]' has been 'whh

Examples
>> matl
 > jttk96-t0>)tstt:\~s4$bn=?xx'nice'}[1,2,0,2]99:ZQ=a?'naughty'}dt0>sw0<s-O>~'very naughty'w?'very 'wh]]]' has been 'whh
 >
> Doorknob
Doorknob has been very naughty

>> matl
 > jttk96-t0>)tstt:\~s4$bn=?xx'nice'}[1,2,0,2]99:ZQ=a?'naughty'}dt0>sw0<s-O>~'very naughty'w?'very 'wh]]]' has been 'whh
 >
> Jakube
Jakube has been nice

Explanation
jt                        % input string. Duplicate
tk96-t0>)                 % duplicate. Convert to lower, then to numbers, remove spaces
ts                        % duplicate. Sum
tt:                       % duplicate. Vector from 1 to obtained sum
\~s                       % modulus operation. Count zeros to determine number of divisors
4$bn=                     % does it equal original name length?
?                         % if so
    xx'nice'              % remove values not needed, and push string
}                         % else
    [1,2,0,2]99:ZQ        % all Christmas numbers
    =a                    % does sum equal any Christmas number?
    ?                     % if so
        'naughty'         % push string
    }                     % else
        dt0>s             % total number of increases
        w0<s              % total number of decreases
        -O>~              % subtract both. Is total <=0?
        'very naughty'w   % push string, which will be needed in either case. Swap
        ?                 % if total was <=0
            'very 'wh     % prepend string
        ]                 % end if
    ]                     % end if
]                         % end if
' has been 'whh           % build complete string from pushed parts

Lua, 371 284 bytes
I'm sure there's room for improvement, I'd like to cut out some if's.
Edit: 4 months later, I learned a lot about lua and wanted to get back to this submission, I did well: cutted out 87 bytes!
a=... .." has been "s=(...):lower()b="very "x=0y=s:byte(1)-96z=0r="naughty"for i=2,#s
do c=s:byte(i)y=c+y-96z=z+c<s:byte(i-1)and-1or 1 end
for i=1,y do x=y%i<1 and x+1or x end
for i=1,13 do d=y==i^3+2*i^2+2 and 0or d end
print(a..(x==#s and"nice"or(d and""or b..(z>0 and""or b))..r))

Ungolfed
a=... .." has been "           -- Start of the sentence
s=(...):lower()                -- convert the input to lower case
b="very "
x=0                            -- y's divisor count
y=s:byte(1)-96                 -- will contain the sum of the char's position in the alphabet
z=0                            -- will contain the raising ladder state
r="naughty"

for i=2,#s                     -- iterate over each character in s
do
  c=s:byte(i)                  -- shorthand for the byte value of the current char
  y=c+y-96                     -- increment the sum of letter's positions
  z=z+c<s:byte(i-1)            -- if the previous char is greater than the current
        and-1                  -- the ladder goes down
      or 1                     -- else, it goes up
end

for i=1,y                      -- iterate on the range 1..y
do
  x=y%i<1                      -- if i is a divisor of y
      and x+1                  -- increment x
    or x
end

for i=1,13                     -- iterate on the range 1..13
do                             -- no need to go further for the christmas numbers
  d=y==i^3+2*i^2+2             -- if y is a christmas number
      and 0                    -- set d
    or d                       -- else let d as it is
end
print(a..                      -- output "Name has been"
      (x==#s                   -- if y's divisor==length of input
        and"nice"              -- append "nice"
      or(d                     -- else, if d is not set
          and""
        or b..                 -- append "very"
          (z>0                 -- and if the raising ladder doesn't raise
             and""
          or b))..             -- append a second "very"
        r))                    -- append "naughty"

Old 371 bytes solution
function f(s)a,b,c,d,e,r,g,s=s.." has been ","very ",0,0,0,"naughty",math.pow,s:lower()for i=1,#s
do if 32<s:byte(i)then e,d=i>1 and(s:byte(i)<s:byte(i-1)and e-1 or e+1)or e,d-96+s:byte(i)end end
for i=1,d do c=d%i>0 and c or c+1 end if c==#s then return a.."nice"end
for i=1,13 do if g(i,3)+2*g(i,2)+2==d then return a..r end end
return e>0 and a..b..r or a..b..b..r end

Ungolfed version :)
function f(s)
  a,b,c,d,e,r,g,s=s.." has been ","very ",0,0,0,"naughty",math.pow,s:lower()
  for i=1,#s
  do
    if 32<s:byte(i)
    then
      --sum of the char's order in the alphabet
      d=d-96+s:byte(i)
      --raising ladder
      e=i>1 and(s:byte(i)<s:byte(i-1)and e-1 or e+1)or e
    end
  end
  for i=1,d
  do
    -- number of d's divisors
    c=d%i>0 and c or c+1
  end
  if c==#s then return a.."nice" end
  for i=1,13
  do
    --Christmas number are equals n^3+2n^2+2 as @Mauris said
    if g(i,3)+2*g(i,2)+2==d then return a..r end
  end
  --is he very naughty or very very naughty?
  return e>0 and a..b..r or a..b..b..r
end

Seriously, 138 bytes
" has been ",;' @-û╗+╝╜`O8ª@-`MΣ;2┐w`iXu`Mπ╜l=`"nice"╛+.éó`╬é03┐2└3╤1x`;;⌐**⌐`MíuY3└+3┐╜Ok0)p)`p;(@)-s@)+(`╬l>Y(Xu3└*"naughty"@"very "*+╛+

Hex Dump:
2220686173206265656e20222c3b2720402d96bb2bbcbd604f38a6402d604de43b32bf7760695875604de3bd6c3d60226e69636522be2b2e82a260ce823033bf32c033d13178603b33405e29a6e7326be4604da1755933c02b33bfbd4f6b3029702960703b2840292d7340292b2860ce6c3e5928587533c02a226e6175676874792240227665727920222a2bbe2b

Try It Online
It is hard to effectively golf this on account of how difficult complicated flow control is in Seriously. The ability to nest functions without the use of registers would help. (I imagine this could already be shortened somewhat through judicious use of stored functions, but it would result in such spaghetti code I don't have the heart to attempt it.)
Explanation:
" has been "                                  push this string
,                                             read input
;' @-û╗                                       copy, remove space, uppercase, put in reg0
+╝                                            put '<input> has been ' in reg1
╜                                             bring back the processed input
`O8ª@-`MΣ                                     convert letters to numbers and sum
;2┐                                           store a copy of the sum in reg2
w`iXu`Mπ                                      compute the number of divisors
╜l                                            get processed input length
=                                             check if they're equal
`"nice"╛+.éó`╬                                if so, run this function that retrieves the
                                              list we made earlier, appends "nice",
                                              prints it, empties the stack
                                              and immediately exits
é                                             empty the stack (it contains a 1)
03┐                                           put a 0 in reg3
2└                                            call back the letter sum from reg2
3╤1x                                          push [1,...1000]
`;;⌐**⌐`M                                     plug each number into x^3+2x^2+2
í                                             check if the letter sum is there
uY                                            make a 1 if it is not, 0 if it is
3└+3┐                                         add this number to reg3
╜Ok                                           convert the processed input into char codes
0)                                            put a zero behind it
p)                                            pop the first char code to bottom of stack
`p;(@)-s@)+(`╬                                Until the list of char codes is empty,
                                              subtract each one from the previous one,
                                              accumulating the signums
l                                             turn the leftover empty list into a 0
>Y                                            put a 1 if the accumulated signs are
                                              >=0 (not rising), else 0 (rising)
(X                                            clean up the last char code
u                                             increment to make 0 into 1 and 1 into 2
3└*                                           bring back the value from reg3
                                              which is 0 if *only* naughty, else 1
                                              and multiply it with preceding test result;
                                              this turns a very into a very very if this
                                              test failed, but leaves plain and single
                                              very naughty alone
"naughty"@                                    put "naughty" below the 'very' count

"very "*                                      put "", "very ", or "very very "
+                                             append the "naughty"
╛+                                            bring back the string in reg1 and append
                                              the constructed suffix

Python 2, 249 bytes
i=input()
g=[ord(c)-96for c in i.lower()if' '!=c]
s=sum(g)
S=0
a=g.pop()
while g:b=a;a=g.pop();S+=(a<b)-(b<a)
r=range(1,14+s)
print i+' has been '+[['very '*(1+(S<1)),''][s in[x**3+2*x**2+2for x in r]]+'naughty','nice'][sum(s%x<1for x in r)==len(i)]

source: Stack Exchange

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

sort: votes


text:
A multiplication table for the Cheela
The Cheela (from the book Dragon's Egg by Robert L. Forward) are creatures that live on the surface of a neutron star. Their body is flat and circular with twelve eyes on the perimeter, so they naturally use a base-12 numbering system.
Among the Cheela, care of the hatchlings and education of the young are tasks carried out by the Old Ones. Since young Cheela need to be taught how to multiply, the Old Ones could use a multiplication table.
Your task is to produce a 12x12 multiplication table in base 12, like the following. Uppercase letters A and B are used for digits corresponding to decimal 10  and 11 respectively.
  1   2   3   4   5   6   7   8   9   A   B  10
  2   4   6   8   A  10  12  14  16  18  1A  20
  3   6   9  10  13  16  19  20  23  26  29  30
  4   8  10  14  18  20  24  28  30  34  38  40
  5   A  13  18  21  26  2B  34  39  42  47  50
  6  10  16  20  26  30  36  40  46  50  56  60
  7  12  19  24  2B  36  41  48  53  5A  65  70
  8  14  20  28  34  40  48  54  60  68  74  80
  9  16  23  30  39  46  53  60  69  76  83  90
  A  18  26  34  42  50  5A  68  76  84  92  A0
  B  1A  29  38  47  56  65  74  83  92  A1  B0
 10  20  30  40  50  60  70  80  90  A0  B0 100

The output shoud be printed on screen. The format should be as follows:

Numbers should be aligned to the right within each column.
Leading spaces before the first column, trailing spaces after the last column, or a trailing new line after the last row are allowed.
Separation between columns can be one space (as shown above) or more than one space, but the number of spaces should be consistent between columns. To measure column separation, consider that displayed numbers include any leading spaces that may have been necessary fo fulfill requirement 1 (so each number occupies three characters, the first of which may be spaces). For example, the table with two-space separation would be as follows:
  1    2    3    4    5    6    7    8    9    A    B   10
  2    4    6    8    A   10   12   14   16   18   1A   20
  3    6    9   10   13   16   19   20   23   26   29   30
  4    8   10   14   18   20   24   28   30   34   38   40
  5    A   13   18   21   26   2B   34   39   42   47   50
  6   10   16   20   26   30   36   40   46   50   56   60
  7   12   19   24   2B   36   41   48   53   5A   65   70
  8   14   20   28   34   40   48   54   60   68   74   80
  9   16   23   30   39   46   53   60   69   76   83   90
  A   18   26   34   42   50   5A   68   76   84   92   A0
  B   1A   29   38   47   56   65   74   83   92   A1   B0
 10   20   30   40   50   60   70   80   90   A0   B0  100

Computer storage on a neutron star is really expensive, so your code should use as few bytes as possible.
Extended challenge and bonus
Ideally your code should be reused in other parts of the universe, where other numbering systems may be in use. To that end, the challenge is optionally extended as follows: Your code accepts a number N as input and generates an NxN multiplication table in base N, with the above format.
Input may be from keyboard or as a function argument. The program or function should work for 2 ≤ N ≤ 36, using as digits the first N characters of the sequence 0, 1, ..., 9, A, B, ..., Z (uppercase letters)
This extended challenge is optional. If you follow this route, take 20% off your byte count (no need to round to an integer number).

Nice one Luis! =) I wish I had the time to come up with a MATLAB solution, but I'm busy measuring Christmas gift dimensions...

Good luck with those spherical hats! :-P

Because they have twelve eyes, they naturally use a base-12 numbering system. Well, naturally. That's why we use binary, after all... ;-)

@TimPederick Good point :-D To clarify: the body of a Cheela is circular, they can reshape limbs as needed... having twelve eyes is numerically the most distinct feature of their bodies. I've updated the question, thanks!

@LuisMendo very nice novel, the one you quote. Starquake isn't bad either.

@Istefano Finally someone who has read it! :-) I loved it. I also read Starquake, but I enjoyed it slightly less. Maybe because I had already read the first one, so the element of surprise had been lost a little

Pyth, 27 * 0.8 = 21.6
VSQsm.[\ 4jkXj*dNQrT99rG1SQ

Try it online: Demonstration
Explanation:
VSQsm.[\ 4jkXj*dNQrT99rG1SQ   implicit: Q = input number
VSQ                           for N in [1, 2, ..., Q]:
    m                    SQ      map each number d in [1, 2, ..., Q] to:
              *dN                   N * d
             j   Q                  in base Q
            X     rT99rG1           replace the numbers [10, 11, ..., 98] with "A...Z"
          jk                        join to a string
     .[\ 4                          prepend spaces, so that the string has a length of 4
   s                             join all strings and print

CJam, 33 * 0.8 = 26.4 bytes
ri:C,:)_ff{*Cb{_9>{'7+}&}%4Se[}N*

Test it here.
This uses the minimum required separation.
Explanation
ri:C        e# Read input, convert to integer, store in C.
,:)         e# Get range [1 2 ... C].
_ff{        e# 2D-map over all repeated pairs from that range...
  *Cb       e#   Multiply, convert to base C.
  {         e#   Map over the digits...
    _9>     e#     Check if the digit is greater than 9.
    {'7+}&  e#     If so, add the digit to the character "7", to get "A" to "Z".
  }%
  4Se[      e#   Pad the digits with spaces from the left, to 4 elements.
}
N*          e# Join with linefeeds.

Table for input 22 (the largest that fits in the post without a horizontal scrollbar):
   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F   G   H   I   J   K   L  10
   2   4   6   8   A   C   E   G   I   K  10  12  14  16  18  1A  1C  1E  1G  1I  1K  20
   3   6   9   C   F   I   L  12  15  18  1B  1E  1H  1K  21  24  27  2A  2D  2G  2J  30
   4   8   C   G   K  12  16  1A  1E  1I  20  24  28  2C  2G  2K  32  36  3A  3E  3I  40
   5   A   F   K  13  18  1D  1I  21  26  2B  2G  2L  34  39  3E  3J  42  47  4C  4H  50
   6   C   I  12  18  1E  1K  24  2A  2G  30  36  3C  3I  42  48  4E  4K  54  5A  5G  60
   7   E   L  16  1D  1K  25  2C  2J  34  3B  3I  43  4A  4H  52  59  5G  61  68  6F  70
   8   G  12  1A  1I  24  2C  2K  36  3E  40  48  4G  52  5A  5I  64  6C  6K  76  7E  80
   9   I  15  1E  21  2A  2J  36  3F  42  4B  4K  57  5G  63  6C  6L  78  7H  84  8D  90
   A   K  18  1I  26  2G  34  3E  42  4C  50  5A  5K  68  6I  76  7G  84  8E  92  9C  A0
   B  10  1B  20  2B  30  3B  40  4B  50  5B  60  6B  70  7B  80  8B  90  9B  A0  AB  B0
   C  12  1E  24  2G  36  3I  48  4K  5A  60  6C  72  7E  84  8G  96  9I  A8  AK  BA  C0
   D  14  1H  28  2L  3C  43  4G  57  5K  6B  72  7F  86  8J  9A  A1  AE  B5  BI  C9  D0
   E  16  1K  2C  34  3I  4A  52  5G  68  70  7E  86  8K  9C  A4  AI  BA  C2  CG  D8  E0
   F  18  21  2G  39  42  4H  5A  63  6I  7B  84  8J  9C  A5  AK  BD  C6  CL  DE  E7  F0
   G  1A  24  2K  3E  48  52  5I  6C  76  80  8G  9A  A4  AK  BE  C8  D2  DI  EC  F6  G0
   H  1C  27  32  3J  4E  59  64  6L  7G  8B  96  A1  AI  BD  C8  D3  DK  EF  FA  G5  H0
   I  1E  2A  36  42  4K  5G  6C  78  84  90  9I  AE  BA  C6  D2  DK  EG  FC  G8  H4  I0
   J  1G  2D  3A  47  54  61  6K  7H  8E  9B  A8  B5  C2  CL  DI  EF  FC  G9  H6  I3  J0
   K  1I  2G  3E  4C  5A  68  76  84  92  A0  AK  BI  CG  DE  EC  FA  G8  H6  I4  J2  K0
   L  1K  2J  3I  4H  5G  6F  7E  8D  9C  AB  BA  C9  D8  E7  F6  G5  H4  I3  J2  K1  L0
  10  20  30  40  50  60  70  80  90  A0  B0  C0  D0  E0  F0  G0  H0  I0  J0  K0  L0 100

MATL, 42*.8 = 33.6
Disclaimer
Since the creator of the language and the author of the challenge are the same, this answer is not eligible for winning.
For a discussion on whether this restriction is necessary or not, see this meta question.
Code
iXK:t!*Y)KYAZ{'(?<=^0*)0'32cYXZc32hK4*[]e!

This uses the minimum separation.
Example
Octal multiplication table
>> matl
 > iXK:t!*Y)KYAZ{'(?<=^0*)0'32cYXZc32chK4*[]e!
 >
> 8
  1   2   3   4   5   6   7  10
  2   4   6  10  12  14  16  20
  3   6  11  14  17  22  25  30
  4  10  14  20  24  30  34  40
  5  12  17  24  31  36  43  50
  6  14  22  30  36  44  52  60
  7  16  25  34  43  52  61  70
 10  20  30  40  50  60  70 100

Explanation
i              % input number, say n
XK             % copy to clipboard K
:              % vector 1, 2, ... n
t!*            % generate table: duplicate, transpose and multiply with broadcasting
Y)             % linearize into column array
KYA            % paste n from clipboard K. Convert to that base
Z{             % cell array of rows from array
'(?<=^0*)0'    % string literal for regexp replacement: find leading zeros
32c            % space character (for regexp replacement)
YX             % regexp replacement
Zc             % join cell array of strings into single string
32             % code for space character. Conversion to char happens automatically
h              % concatenate horizontally
K4*[]e!        % paste n and multiply by 4. Reshape into 2D char array with 4*n columns

Edit: Try it online!
To run in the online compiler (as of February 19, 2016), change Y) to X:, and remove []. This is to adapt to changes that have been made to the language since this challenge was posted.

"Since the creator of the language and the author of the challenge are the same, this answer is not eligible for winning." I wasn't aware of this restriction. Is this self-imposed or did you find a relevant meta consensus?

@AlexA. I self-imposed it. I suspected there probably was some kind of agreement regarding that. From your commnent I see there isn't there any? My point is: if you design a language and then post a challenge, you are probably at an advantageous position. What's usually done about that? Not any restriction?

I would think you aren't necessarily at an advantage so long as you don't plan a challenge specifically as a use case for a built-in in your language. I don't know of any such consensus offhand, so I recommend asking on meta.

@AlexA. Good idea! Done

@AlexA. If you feel like doing it, maybe add your suggestion as an answer there?

Bash + BSD utilities, 36
echo Co{1..12}d{1..12}*p|dc|rs -j 12

Works out-of-the-box on OS X.  rs may need to be installed on Linux systems.

Bash expands Co{1..12}d{1..12}*p to Co1d1*p Co1d2*p Co1d3*p ... Co1d12*p ... Co12d12*p.
This is a dc expression that generates the required terms.  Co sets output base to 12.  d is used as a separator between numbers instead of a space, so no escape is required in the brace expansion.  d actually duplicates the top of stack, but this is effectively ignored and discarded.
The output from dc is a single space-separated line.  rs reshapes this to a 12x12 array.  -j right-justifies each term.

Pyth, 36 bytes
Km+1dUJ12rjbmjkm.[\ 4j""m.Hbj*dkJKK1

Try it here.

You can replace Km+1dUJ12 with KSJ12. S creates the range [1, 2, ..., 12]. You can replace both j"" and jk with s, since your joining strings. And another byte: Change rjbm...K1 to jmr...1K. With this changes you get 28 bytes: KSJ12jmrsm.[\ 4sm.Hbj*dkJK1K

CJam, 38 33 32 38 * (.8) = 30.4 bytes
qi:D,:):L{Lf*{Db{_9>{55+c}&}%4Se[}%N}%

Try it here.
(Looks pretty similar to Martin's now.)
qi:D,:):L          e# Generate list of [1...input]
{Lf*               e# Take each number in that list and multiply it by the same list ([[1,2,3,..,input][2,4,6,...,input],...})
{Db{_9>{55+c}&}%   e# Convert each product to base input. If a digit value is >= 10 add 55 and convert to char, to make it a letter.
4Se[}%N}%          e# Pad each number with spaces to length 4. Put a newline after each row.

Python, 153 147 132 bytes * 0.8 = 105.6
def p(b):
 f=lambda n:(n>=b and f(n/b)or'')+chr((48,55)[n%b>9]+n%b)
 for i in range(b*b):print'%4s\n'[:3+(~i%b<1)]%f(~(i%b)*~(i/b)),

Down to 132 bytes thanks to the advice of Tim Pederick! :)

Upvoted, because the more I golf my answer, the more it starts to look like yours!

Some possible improvements: Use %-formatting instead of rjust ('%4s'%f(...)). See whether printing each value with print ..., (and then one print for the newline) is shorter than join. If so, try collapsing the loops.

Thanks Tim, I tried collapsing the loops (I didn't know this trick). I'm not sure it makes me gain many bytes if any but it's pretty cool :)

I see you switched to a ternary form (condition and A or B) inside function f, using n>=b. I did that until I realised that it was no shorter than what I had before, n//b... but you're using Python 2! You can save a byte with n/b.

Yes that's the reason I used this part of your code exploiting python 2 to save one more byte :)

By the way this ternary form: does "and" have precedence over "or" or is it just a left to right kind of thing? Also I'm not too sure why it returns the value of f or '' instead of just true

Python 3, 126 - 20% = 100.8 bytes
The outer function, t, is the one that actually prints the multiplication table. The inner function, i, does the conversion of a number to a base from 2 to 36.
def t(b):
 i=lambda n:(n>=b and i(n//b)or'')+chr(n%b+[48,55][n%b>9]);R=range(b)
 for r in R:print(*('%3s'%i(~r*~c)for c in R))

Hat tip to Boomerang for their solution, and for a golfing tip. I avoided copying anything from Boomerang's solution, but I did allow myself glances at it to see where I could trim more out. And even before that, I found that the more I golfed it, the more mine started to look like Boomerang's!

Nice solution! :) And you get a better score than me! I like the >9 instead of my <10. I'm not too familiar with python3 and starred expressions (I had to look that up). I love your ~ trick, I need to start using that!

I tested your solution a bit and it looks like i doesn't return more than two base n digits. For example if you do print(i(15,12),i(120,12),i(144,12),i(150,12)) your code returns 13 A0 00 06 instead of 13 A0 100 106. Unfortunately the task requires to print one 3 digit base n number (100). It shouldn't be too difficult to fix but it might add a few bytes...

@Boomerang:  I think I must've broken something, then... because it was working before! The issue appears to be that it won't give a leading 1... oh, wait, I know what the problem is. It should be n>=b, not n>b.

I found another trick to make the code smaller: define i within t(b) so you can remove the second argument in i! Like this:
def t(b):  i=lambda n:(n>=b and i(n//b)or'')+chr(n%b+[48,55][n%b>9])  R=range(b)  for r in R:print(*('%3s'%i(~r*~c)for c in R)) I'd like to do that in my solution but now both our solutions are pretty close, might as well improve the better one ^^

@Boomerang: Hey, yours was first, and I think Python 2 offers enough shortcuts that you could still overtake me. But thanks for the help!

If you do this trick you can gain one more byte by having i=... and R=... on the same line (basically replacing "\n " by ";")

JavaScript (ES6) 84 (105-20%)
The obvious way, to begin with.
n=>{for(o=i=``;i++<n;o+=`
`)for(j=0;j++<n;)o+=(`   `+(i*j).toString(n)).slice(-4).toUpperCase();alert(o)}

Notes

It's a pity js toString produce lowercase letters
alert is not the best way to output the table, but it's the shorter, as there is an explicit request to "display on screen"
Just returning the value would be a couple bytes shorter.

Less golfed
n=>{
  for(o='', i=0; i++<n; o+='\n')
    for(j=0;j++<n;)
       o+=('   '+(i*j).toString(n)).slice(-4).toUpperCase()
  alert(o)
}

Javascript (ES6) 96.8 93.6 Bytes (20% of 117)
n=>{b='';for(i=0;i++<n;b+=`\n`)for(j=0;j++<n;)a=(i*j).toString(n).toUpperCase(),b+=' '.repeat(4-a.length)+a;alert(b)}

Explanation
n=>
    {
      b='';                                    //clear table var at each run
      for(i=0;i++<n;b+=`\n`)                   //iterate through rows
        for(j=0;j++<n;)                        //iterate through cols
          a=(i*j).toString(n).toUpperCase(),   //get desired number
          b+=' '.repeat(4-a.length)+a";        //pad to right
    alert(b)                                   //display result
}

-saved 4 bytes thanks to @edc65

Simply using {} and alert(b) with no eval is shorter. And at least, avoid variable a, it's useless b+=' '.repeat(4-a.length)+(i*j).toString(n).toUpperCase()

Thanks  I didn't see the need to display it so for me eval() was originally shorter than returning the value.
@edc65 however, if I avoid a how do you then compute ...repeat(4-a.length)...?

Ugh sorry you're right about a. +1 as is

Perl 6, 60 bytes -20% = 48 bytes
{.put for (1..$_ X*1..$_)».base($_)».fmt('%3s').rotor($_)} # 60-20% = 48
#          ^-----------^ produce a list of two cross multiplied lists
#                        ^--------^ convert each to base N
#          format each to 3 spaces ^----------^
#         split the list into N element chunks ^--------^
#^-------^ print each of those on their own line with spaces between elements

( This is almost exactly how I would write it even if I wasn't trying to get it as short as I could )
Usage:
{...}(2)
  1  10
 10 100

my &code = {...}
code 2;
  1  10
 10 100

{...}(12);
  1   2   3   4   5   6   7   8   9   A   B  10
  2   4   6   8   A  10  12  14  16  18  1A  20
  3   6   9  10  13  16  19  20  23  26  29  30
  4   8  10  14  18  20  24  28  30  34  38  40
  5   A  13  18  21  26  2B  34  39  42  47  50
  6  10  16  20  26  30  36  40  46  50  56  60
  7  12  19  24  2B  36  41  48  53  5A  65  70
  8  14  20  28  34  40  48  54  60  68  74  80
  9  16  23  30  39  46  53  60  69  76  83  90
  A  18  26  34  42  50  5A  68  76  84  92  A0
  B  1A  29  38  47  56  65  74  83  92  A1  B0
 10  20  30  40  50  60  70  80  90  A0  B0 100

{...}(18);
  1   2   3   4   5   6   7   8   9   A   B   C   D   E   F   G   H  10
  2   4   6   8   A   C   E   G  10  12  14  16  18  1A  1C  1E  1G  20
  3   6   9   C   F  10  13  16  19  1C  1F  20  23  26  29  2C  2F  30
  4   8   C   G  12  16  1A  1E  20  24  28  2C  2G  32  36  3A  3E  40
  5   A   F  12  17  1C  1H  24  29  2E  31  36  3B  3G  43  48  4D  50
  6   C  10  16  1C  20  26  2C  30  36  3C  40  46  4C  50  56  5C  60
  7   E  13  1A  1H  26  2D  32  39  3G  45  4C  51  58  5F  64  6B  70
  8   G  16  1E  24  2C  32  3A  40  48  4G  56  5E  64  6C  72  7A  80
  9  10  19  20  29  30  39  40  49  50  59  60  69  70  79  80  89  90
  A  12  1C  24  2E  36  3G  48  50  5A  62  6C  74  7E  86  8G  98  A0
  B  14  1F  28  31  3C  45  4G  59  62  6D  76  7H  8A  93  9E  A7  B0
  C  16  20  2C  36  40  4C  56  60  6C  76  80  8C  96  A0  AC  B6  C0
  D  18  23  2G  3B  46  51  5E  69  74  7H  8C  97  A2  AF  BA  C5  D0
  E  1A  26  32  3G  4C  58  64  70  7E  8A  96  A2  AG  BC  C8  D4  E0
  F  1C  29  36  43  50  5F  6C  79  86  93  A0  AF  BC  C9  D6  E3  F0
  G  1E  2C  3A  48  56  64  72  80  8G  9E  AC  BA  C8  D6  E4  F2  G0
  H  1G  2F  3E  4D  5C  6B  7A  89  98  A7  B6  C5  D4  E3  F2  G1  H0
 10  20  30  40  50  60  70  80  90  A0  B0  C0  D0  E0  F0  G0  H0 100

Not an expert,  but is the space between 'for' and '(' required? Gotta clip the spaces where possible.

@J_F_B_M I always try removing spaces first. So if there is a space it is required. If I did remove the space it for sure wouldn't even compile as it would treat for( as the beginning of calling a subroutine named for instead of the modifier for loop construct. Which would cause a compilation error.

Learned something. Thank you.

MATLAB, 111*0.8=88.8 110*0.8=88  bytes
My debut here:
@(N)disp(reshape(strrep(strrep([' ',strjoin(cellstr(dec2base([1:N]'*[1:N],N)))],' 0','  '),' 0','  '),4*N,N)')

Explanation:
[1:N]'*[1:N] make multiplication table in base 10
dec2base([1:N]'*[1:N],N) convert to base 12. The output is char array with leading 0-s
strjoin(cellstr(dec2base(___))) convert to cell and back to char joining strings with space yielding 1x575 string
[' ',strjoin(___)] append space to have 576 elements
strrep(___,' 0','  ') remove one leading zero. We do it twice because we have strings with two leading zeros
reshape(___,4*N,N)' convert 1x576 char array into  48x12 char array
disp(___) display the result without ans =
Output:
 1   2   3   4   5   6   7   8   9   A   B  10
 2   4   6   8   A  10  12  14  16  18  1A  20
 3   6   9  10  13  16  19  20  23  26  29  30
 4   8  10  14  18  20  24  28  30  34  38  40
 5   A  13  18  21  26  2B  34  39  42  47  50
 6  10  16  20  26  30  36  40  46  50  56  60
 7  12  19  24  2B  36  41  48  53  5A  65  70
 8  14  20  28  34  40  48  54  60  68  74  80
 9  16  23  30  39  46  53  60  69  76  83  90
 A  18  26  34  42  50  5A  68  76  84  92  A0
 B  1A  29  38  47  56  65  74  83  92  A1  B0
10  20  30  40  50  60  70  80  90  A0  B0 100

If we don't count statement N=12;, 5*.8=4 bytes are saved. Also, if ans = output is tolerated, then we can remove disp() saving another 6*0.8=4.8 bytes. Of course, there may be other ways to save bytes :)

In general, ans output is tolerated if the output is a function argument. But in this case the challenge says "output should be printed on screen", so ans is not allowed. Also, N should be taken as an input in the extended challenge. You can solve that using an anonymous function: @(n)disp(reshape(strrep(strrep([' ',strjoin(cellstr(dec2base([1:N]'*[1:N],N)))],' 0','  '),' 0','  '),4*N,N)'), which you would call using ans(12)

Oh and welcome to the site! :-)

@LuisMendo thanks! I'll edit my answer with @(N) notation

Python 3: 166 161 152 - 20% = 121.6 bytes
I know it's inferior to the existing Python answers but I figured to give it a shot. It's my first time posting on this site…
def t(b):
 r=range(1,b+1);f=lambda x:x and f(x//b)+chr((55,48)[x%b>9]+x%b)or''
 print('\n'.join(''.join(B)for B in(('%4s'%f(i*j)for j in r)for i in r)))

There are 3 closing parenthesis and 2 numeric literals followed by spaces. Those spaces are unnecessary. Otherwise nice first try. BTW, Tips for golfing in Python is a nice reading.

Welcome to PPCG.SE, even if it doesn't beat other Python answer, as long as it is different (not the same algorythm/idea), you can post it :).

@manatwork Thanks! I got another 9 bytes off with that.

APL, 32 31×0.8=24.8 bytes
{¯4↑¨⊃∘(⎕D,⎕A)¨¨⍵⊥⍣¯1¨∘.×⍨1+⍳⍵}

In origin 0.
In English:

∘.×⍨1+⍳⍵: multiplication table
⍵⊥⍣¯1¨: express in base ⍵ each element of the multiplication table
⊃∘(⎕D,⎕A)¨¨: convert the table of vector of numbers into a table of vectors of chars
¯4↑¨: right align to length 4 each element of the result

The default APL print routine does the right thing.
      {¯4↑¨(⍵⊥⍣¯1¨∘.×⍨1+⍳⍵)⊃¨¨⊂⊂⎕D,⎕A}13
    1     2     3     4     5     6     7     8     9     A     B     C    10
    2     4     6     8     A     C    11    13    15    17    19    1B    20
    3     6     9     C    12    15    18    1B    21    24    27    2A    30
    4     8     C    13    17    1B    22    26    2A    31    35    39    40
    5     A    12    17    1C    24    29    31    36    3B    43    48    50
    6     C    15    1B    24    2A    33    39    42    48    51    57    60
    7    11    18    22    29    33    3A    44    4B    55    5C    66    70
    8    13    1B    26    31    39    44    4C    57    62    6A    75    80
    9    15    21    2A    36    42    4B    57    63    6C    78    84    90
    A    17    24    31    3B    48    55    62    6C    79    86    93    A0
    B    19    27    35    43    51    5C    6A    78    86    94    A2    B0
    C    1B    2A    39    48    57    66    75    84    93    A2    B1    C0
   10    20    30    40    50    60    70    80    90    A0    B0    C0   100

–1: {¯4↑¨⊃∘(⎕D,⎕A)¨¨⍵⊥⍣¯1¨∘.×⍨1+⍳⍵}

Instead of "chars" you should use "bytes" with a link to http://meta.codegolf.stackexchange.com/a/9429/43319.

Vyxal, 20 \$\times\$ 0.8 = 16 bytes
ɾ:v*$τkdkAJİṅ:fÞGL↳⁋

Try it Online!
This could actually be 9*0.8=7.2 bytes if Vyxal had a gridify builtin and a buitlin to convert to a base as a string (with letters).

Ruby, 69 66 characters - 20% = 52.8
->n{(r=1..n).map{|a|puts r.map{|b|"%4s"%(a*b).to_s(n).upcase}*''}}

Sample run:
2.1.5 :001 > ->n{(r=1..n).map{|a|puts r.map{|b|"%4s"%(a*b).to_s(n).upcase}*''}}[4]
   1   2   3  10
   2  10  12  20
   3  12  21  30
  10  20  30 100

ksh93, 51 * 0.8 == 40.8 bytes
eval echo "'
' {"{1..$1}'..$((++n*$1))..$n%3..$1d}'

This should work up to base 64 (the largest radix supported by ksh). Examples:
 $ n= ksh -s 12 <<\EOF
eval echo "'
' {"{1..$1}'..$((++n*$1))..$n%3..$1d}'
EOF

   1   2   3   4   5   6   7   8   9   a   b  10
   2   4   6   8   a  10  12  14  16  18  1a  20
   3   6   9  10  13  16  19  20  23  26  29  30
   4   8  10  14  18  20  24  28  30  34  38  40
   5   a  13  18  21  26  2b  34  39  42  47  50
   6  10  16  20  26  30  36  40  46  50  56  60
   7  12  19  24  2b  36  41  48  53  5a  65  70
   8  14  20  28  34  40  48  54  60  68  74  80
   9  16  23  30  39  46  53  60  69  76  83  90
   a  18  26  34  42  50  5a  68  76  84  92  a0
   b  1a  29  38  47  56  65  74  83  92  a1  b0
  10  20  30  40  50  60  70  80  90  a0  b0 100

 $ n= ksh -s 22 <<\EOF
eval echo "'
' {"{1..$1}'..$((++n*$1))..$n%3..$1d}'
EOF

   1   2   3   4   5   6   7   8   9   a   b   c   d   e   f   g   h   i   j   k   l  10
   2   4   6   8   a   c   e   g   i   k  10  12  14  16  18  1a  1c  1e  1g  1i  1k  20
   3   6   9   c   f   i   l  12  15  18  1b  1e  1h  1k  21  24  27  2a  2d  2g  2j  30
   4   8   c   g   k  12  16  1a  1e  1i  20  24  28  2c  2g  2k  32  36  3a  3e  3i  40
   5   a   f   k  13  18  1d  1i  21  26  2b  2g  2l  34  39  3e  3j  42  47  4c  4h  50
   6   c   i  12  18  1e  1k  24  2a  2g  30  36  3c  3i  42  48  4e  4k  54  5a  5g  60
   7   e   l  16  1d  1k  25  2c  2j  34  3b  3i  43  4a  4h  52  59  5g  61  68  6f  70
   8   g  12  1a  1i  24  2c  2k  36  3e  40  48  4g  52  5a  5i  64  6c  6k  76  7e  80
   9   i  15  1e  21  2a  2j  36  3f  42  4b  4k  57  5g  63  6c  6l  78  7h  84  8d  90
   a   k  18  1i  26  2g  34  3e  42  4c  50  5a  5k  68  6i  76  7g  84  8e  92  9c  a0
   b  10  1b  20  2b  30  3b  40  4b  50  5b  60  6b  70  7b  80  8b  90  9b  a0  ab  b0
   c  12  1e  24  2g  36  3i  48  4k  5a  60  6c  72  7e  84  8g  96  9i  a8  ak  ba  c0
   d  14  1h  28  2l  3c  43  4g  57  5k  6b  72  7f  86  8j  9a  a1  ae  b5  bi  c9  d0
   e  16  1k  2c  34  3i  4a  52  5g  68  70  7e  86  8k  9c  a4  ai  ba  c2  cg  d8  e0
   f  18  21  2g  39  42  4h  5a  63  6i  7b  84  8j  9c  a5  ak  bd  c6  cl  de  e7  f0
   g  1a  24  2k  3e  48  52  5i  6c  76  80  8g  9a  a4  ak  be  c8  d2  di  ec  f6  g0
   h  1c  27  32  3j  4e  59  64  6l  7g  8b  96  a1  ai  bd  c8  d3  dk  ef  fa  g5  h0
   i  1e  2a  36  42  4k  5g  6c  78  84  90  9i  ae  ba  c6  d2  dk  eg  fc  g8  h4  i0
   j  1g  2d  3a  47  54  61  6k  7h  8e  9b  a8  b5  c2  cl  di  ef  fc  g9  h6  i3  j0
   k  1i  2g  3e  4c  5a  68  76  84  92  a0  ak  bi  cg  de  ec  fa  g8  h6  i4  j2  k0
   l  1k  2j  3i  4h  5g  6f  7e  8d  9c  ab  ba  c9  d8  e7  f6  g5  h4  i3  j2  k1  l0
  10  20  30  40  50  60  70  80  90  a0  b0  c0  d0  e0  f0  g0  h0  i0  j0  k0  l0 100

Pyke, 14 bytes * 0.8 = 11.2 bytes, noncompetitive
QhD]UA*MbQMl2P

Try it here!
Explanation:
            - autoassign Q = eval_or_not_input()
QhD]        - [Q+1, Q+1]
    U       - nd_range(^)
     A*     - apply(*, ^)
       MbQ  - map(base(Q), ^)
          Ml2 - map(lower, ^)
          P - print_grid(^)

Or 12 bytes without the bonus
13D]UA*Mb12P

The challenge specifies uppercase letters

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

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


text:
How much water is left?
Here in California, we're in a drought so we need to know how much water we have left so we can conserve as much water as possible.
Because water is limited supply, your code will need to be as short as possible.
Examples
|   |
|   |
|~~~|
|___|

Output: 0.5

|~~~~~|
|     |
|     |
|_____|

Output: 1

|  |
|__|

Output: 0 (or bonus)

Specification
The input will consist solely of all of: |_ ~ and newlines. All above the ~'s are considered air; _, spaces below ~, and ~ itself are considered water. The percent of water left is computer by water / (air + water). Your output needs to be accurate to 4 decimal places (unless you go for the percent bonus). The input will always be rectangular. The ~ will only be on one line, if on any. The input may optionally also have a trailing line feed if you'd like.
Bonus
If you go for both bonuses the -15% bonus is applied before the -35 bonus
-35 byte Bonus: If your code prints "This drought goat out of hand", instead of 0 when the Output is 0
-15% Bonus: If you output a percent.
To do this, you would shift the decimal place two places to the left, trim leading zeros, and add a % to the end. Trailing zeros (max 2) are allows as long as they don't affect the value. 0.5 -> any of: 50.00% 50% 50.0%

"Because water is limited supply, your code will need to be as short as possible." uhhh okay, makes sense... I guess?

@Fatalize: It's not common knowledge outside the state, but fluidic logic-based computers are extremely popular in California. I hear they're trying to see if they can work out an almond-based alternative these days.

@JohnE that probably explains why there is a drought there now

You guys know that fluidic computers don't use up water, right? Just like electric computers don't cause electron shortages.

Is this : |~~~| (no underscore) valid input?

Kind of same as @edc65's question from other point of view: can the tank in 1st example ever be 25% full?

According to your specification, the third example should result in 0.5.

Repeating this because it seems rather important. You say that _ counts as water, so the bottom row of the third example is water. Actually, on re-reading, "everything above the ~ counts as air" - there is nothing about the ~ because there is no ~, therefore there is no air and there is only water, so an "empty" input should result in 1.0.

Generally, bonuses are considered a bad idea, but since there are too many answers already, I don't think we can do anything about it.

Pyth - 17 46 45 52 * .85 - 35 = 9.2 bytes
Filters the input (With the new # filter meta-op!) for a line with ~ in it, then indexes that to the input, and then divides that by the length of the input. If there are none with ~, it errors, and triggers the except clause of .x and prints the string.
.x+*100-1cxK.zh@#\~KlK\%." u(C$éáPãbÉãç*îÂe[W

Try it online here.

Python 3, 37 bytes
lambda x:1-(x+'|~').find('|~')/len(x)

No bonuses. Takes an input string with newlines, including a trailing newline.
Let's look at why the formula works. The fraction of water is the complement of the fraction of air, which we'll derive.
frac_water = 1 - frac_air

Numbering the rows 0, 1, 2, ..., we have
frac_air = water_row_index / num_rows

The same is true if both are multiplied by the width of each row, counting newlines, which simplify to expressions in the number of characters.
frac_air = (width * water_row_index) / (width * num_rows)
         = water_row_start_char_index / num_chars

The water row start is found by searching the input string x for |~, and the number of chars is just the length.
frac_air = x.find('|~') / len(x)

Finally, in order to make no-water inputs work, we append a fictional water row start |~ to the end before searching, which makes it look like the water level is 0.
The bonuses seemed not worth it. The best I got on the string one is 73-35=38:
lambda x:['This drought goat out of hand',1-x.find('|~')/len(x)]['~'in x]

CJam, 19 17 16 58 * 0.85 - 35 = 14.3 bytes
q'|-_'~#_)\@,d/1\m100*s'%+"This drought goat out of hand"?

Try it online
This version gets both bonuses. The input must have a trailing newline for this solution to work.
Thanks to @Martin Büttner for saving 2 bytes.
Explanation:
q       Get input.
'|-     Remove left/right wall, so that position of first ~ in remaining string
        corresponds to the water level.
_       Make a copy.
'~#     Find ~ character.
_)      Make copy of find result, and increment it. This is 0 if the ~
        was not found, and will be used for the bonus condition.
\       Swap original find result to top.
@,      Rotate copy of remaining input to top, and get its length.
d       Convert to double to get float division.
/       Divide the two values. Since the position of the ~ was indexed from
        the top, this is 1 minus the desired result.
1\m     Subtract value from 1, to get the actual result.
100*    Multiply by 100 to get percent.
s       Convert to string.
'%+     Append % sign.
"This drought goat out of hand"
        Push bonus zero string.
?       Ternary operator to pick calculated result or zero string.

JavaScript (ES6), 45 (94 -15% -35)
As an anonymous function. Using template strings, there is a newline that is significant and included in the byte count
Edit 1 byte saved thx @user81655
p=>p.split`
`.map((r,i)=>r>'|~'?p=i:q=~i)&&q-p?(1+p/q)*100+'%':'This drought goat out of hand'

Less golfed
p=>(
  p.split('\n') // split in rows
  .map((r,i)=> // execute for each row
    r>'|~'   // look for the water top
      ? p=i  // position of water top in p
      : q=~i // if not water top, set current position (-i-1) in q
  ),
  // at the end,if water top not found, p still contains the input string
  q-p // subtracting the input string I get NaN (that is a falsy value)
  ? (1+p/q)*100+'%' // calc % taking into account the negative sign of q
  : 'This drought goat out of hand'
)

Test snippet

F=p=>p.split`\n`.map((r,i)=>r>'|~'?p=i:q=~i)&&q-p?(1+p/q)*100+'%':'This drought goat out of hand'

function Update() {
  var w=+W.value, h=+H.value, t=+T.value,
      b=Array(h).fill().map((r,i)=>'|'+(i==h-1?'_':i==t?'~':' ').repeat(w)+'|').join`\n`
  O.textContent = b+'\n\n'+F(b)

}

Update()

Width	<input id=W type=number value=4 oninput='Update()'>

Height	<input id=H type=number value=4 oninput='Update()'>

~~~ at row	<input id=T type=number value=2 oninput='Update()'>

Beautiful test snippet and great code as always! One suggestion: You could replace p=~i with p=i, &&-p with &&p-q and 1+~p to 1+p to save 1 byte.

@user81655 nice suggestion, thanks

Par, 57 * 85% - 35 = 13.45 bytes
`This drought goat out of hand`r√″T┐↑⌐'~˦↑↔~÷Zx²*'%↔╡\z_g

Explanation
`This dr...d`  ## 'This drought goat out of hand'
r              ## Read entire input
√              ## Split by newlines
″              ## Duplicate
T              ## Transpose
┐↑             ## Second element of each line
⌐              ## Reverse
'~˦            ## First index of '~'
↑              ## Plus one
↔              ## Swap
~÷             ## Divide by size
Z              ## Assign to z
x²*            ## Multiply by 100
'%↔╡           ## Append '%'
\              ## Array of string and number
z_g            ## If z=0, then string; else, number

Perl, 70 - 15% - 35 = 24.5 bytes
includes +1 for -p
 $S[$w|=/~/]++}{$_=$w?100*$S[1]/$..'%':'This drought goat out of hand'

With comments:
$S[ $w |= /~/ ]++                   # $w=0 for air, 1 for having seen water; count element
}{                                  # -n/-p: end the `while(<>){` and begin END block
$_ = $w                             # assign output for -p
  ? 100 * $S[1] / $. . '%'          # $. is $INPUT_LINE_NUMBER
  :'This drought goat out of hand'  # costs 35 aswell, but is effectively more after -15%

26+1 byte version, no bonus: 27
$S[$w|=/~/]++}{$_=$S[1]/$.

34+1 byte version, with 15% bonus: 29.75
$S[$w|=/~/]++}{$_=100*$S[1]/$..'%'

61+1 byte version, with -35 bonus: 27
$S[$w|=/~/]++}{$_=$w?$S[1]/$.:'This drought goat out of hand'

69+1 byte version, both bonuses: 24.50
$S[$w|=/~/]++}{$_=$w?100*$S[1]/$..'%':'This drought goat out of hand'

Javascript, 59.3
I hope extra decimal places are OK. Assumes no trailing newline.

drought=
// code
a=>(b=-1,e=a.split`
`.map((c,d)=>b=c[1]=='~'?d:b).length,++b?(e-b+1)*100/e+"%":"This drought goat out of hand")

// I/O
var i = document.getElementById("i");
var o = document.getElementById("o");
i.onchange = i.onkeyup = function(){
  o.textContent = drought(i.value);
};

// explanation
inputStr=>(
  tildePosition = -1, // default: not found
  containerDepth =    // if the current line has a tilde, set tildePosition, otherwise
                      // keep current tildePosition
      inputStr.split`\n`.map((line, pos)=> tildePosition = line[1]=='~' ? pos : tildePosition)
    .length,          // assign number of lines (container depth) to containerDepth
  ++tildePosition     // if it's still -1, print the message, otherwise print percent
    ?(containerDepth-tildePosition+1)*100/containerDepth+"%"
    :"This drought goat out of hand")
<textarea id="i"></textarea>

Python is verbose!
Python: 98.45 bytes
(157 * 0.85) - 35 = 98.45 bytes
This version reads from stdin, and collects both bonuses:
import sys
r=[x[1]for x in sys.stdin.read().split('\n|')]
o="This drought goat out of hand"if'~'not in r else"%g%%"%(100-100.0*r.index('~')/len(r))
print(o)

66 without any bonuses: import sys;r=[x[1]for x in sys.stdin];print(1-r.index('~')/len(r))

Nice! That gets tripped up by the optional trailing newline though, doesn't it? Also, is it Python 3-only because of the division operator?

The optional trailing newline is up to you to include. As for the division, yeah, but you're already treating print like a function so I assumed you were using Python 3.

Awk, 72 characters - 15% - 35 = 26.2
/~/{w=NR}END{print w?(NR-w+1)/NR*100"%":"This drought goat out of hand"}

Sample run:
(Initial 1; only used in these sample runs to display the “human readable” tank.)
bash-4.3$ awk '1;/~/{w=NR}END{print w?(NR-w+1)/NR*100"%":"This drought goat out of hand"}' <<< $'| |\n| |\n| |\n|_|'
| |
| |
| |
|_|
This drought goat out of hand

bash-4.3$ awk '1;/~/{w=NR}END{print w?(NR-w+1)/NR*100"%":"This drought goat out of hand"}' <<< $'| |\n| |\n|~|\n|_|'
| |
| |
|~|
|_|
50%

PHP, 92 characters - 15% - 35 = 43.2
(88 characters in two blocks of code + 4 characters command line options.)
$argn[1]>z&&$w=+$argi;

echo$w?100*($argi-$w+1)/$argi."%":"This drought goat out of hand";

Assumes error_reporting is set to default.
(Not a big deal, just wished to use the -R and -E once. Now only -B left.)
Sample run:
(Initial echo"$argn\n"; only used in these sample runs to display the “human readable” tank.)
bash-4.3$ php -R 'echo"$argn\n";$argn[1]>z&&$w=+$argi;' -E 'echo$w?100*($argi-$w+1)/$argi."%":"This drought goat out of hand";' <<< $'| |\n| |\n| |\n|_|'
| |
| |
| |
|_|
This drought goat out of hand

bash-4.3$ php -R 'echo"$argn\n";$argn[1]>z&&$w=+$argi;' -E 'echo$w?100*($argi-$w+1)/$argi."%":"This drought goat out of hand";' <<< $'| |\n| |\n|~|\n|_|'
| |
| |
|~|
|_|
50%

Haskell, 56 bytes
l=sum.(>>[1])
f i|s<-lines i=l(snd$break(elem '~')s)/l s

Usage example: f "|  |\n|~~|\n|  |\n|__|" -> 0.75.
l is a custom length function, which is necessary, because the build in length returns integer values, but we need floating point values for the division (there's genericLength which also provides this feature, but it's longer, let alone the required import Data.List). f splits the input i into lines (-> s) and then into a pair where the first element is a list with all the lines up to (and excluding) the first one with a ~ in it. The second element is a list with the rest of the lines. The result is the length of the second element divided by the length of s.
The bonuses don't pay off.

QBIC - 116 - 15% = 98.6 bytes
{input S$:S$=MID$(S$,2,1):I=I+1:IF y<1 then x=I
y=y+instr(S$,"~"):IF instr(S$,"_")>0 THEN ?(1-(x-y)/I)*100;"%":END}

I've created QBIC to make QBasic more competitive, but it still needs several improvements. As of now, there are no shortcuts for error trapping, THEN (which is a pretty big oversight on my part) and input$. They will be added shortly.
I couldn't hit the 0 bonus, too costly... I did manage to print percentages.
Sample in/output:
? |  |
? |  |
? |~~|
? |__|
 50 %

The program reads the input interactively. When it detects the bottom of the lake (_) it prints the percentage and quits. Tested for full containers and empty ones as well.
Edit: To show how QBIC has been expanded during the last year, here's the same program written for the current interpreter:
{_?A=$MID$|(A,2,1)#~|#_| i=i+1~j<1|k=i]j=j+instr(A,B)~instr(A,C)|?(1-(k-j)/i)*100,@%|_X

87 bytes, printing percentages, is a score of 74.