text:
The Floating Horde
Introduction
The rain finally subsided. Most of humanity drowned due to a bug in @user12345's code. Survivors are scattered across a worldwide archipelago. Radio communication is up, and humanity is poised to thrive once more. For no reason whatsoever, zombie pirates have gathered at the Prime Meridian, and are sweeping westward. The horde devours all.
Problem
Our doomsday scenario can be described by 5 integers on a single line which represent a set of cooperating island communities. They are ordered from west (leftmost integer) to east (rightmost integer).
Beginning with the island farthest east, islanders flee in pairs to the next closest island. Curiously, for each pair that embarks, only one of them ever survives the trip. Islanders only travel in pairs. Odd populations elect a sole inhabitant to stay behind and provide the latest radio updates on the antics of the zombie pirate horde. Populations refuse to travel until all islands to the east of them have completed their migrations or died. When the population reaches the final, westernmost island, travel ceases.
The operations manager at the end of the world needs a program that can output the final population counts of each village.
Example Input
3 8 6 0 2
Example Output
8 1 0 1 0
Assumptions

Input may be provided via stdin, read from an arbitrarily named file, or accepted as an argument
For each island, 0 <= population <= 1024
Populations never skip an island

Shortest answer wins!

When you say argument, do you mean as an argument to a function or as a command-line argument to the program?

@AleksiTorhamo Command-line arg, so it wouldn't count toward your total.

I love this multi-question-spanning doomsday story.

re: "populations never skip an island" - your example does show population moving multiple islands in a row. Is there another meaning I'm missing?

@AllenGould The populations did indeed move across multiple islands, but they never skipped one. If there were 32 people on the far right island, they would die like 16, 8, 4, and finally 2 would reach the leftmost island.

@Rusher - ah. Thanks for the clarification.

APL, 16 characters
{(1e9,4⍴2)⊤2⊥⍎⍵}

The input is provided as string to this block:
{(1e9,4⍴2)⊤2⊥⍵} "3 8 6 0 2"
8 1 0 1 0

or one char less if the input is provided as argument to this block:
{(1e9,4⍴2)⊤2⊥⍵} 3 8 6 0 2
8 1 0 1 0

It is based on the idea of Ilmari Karonen in this comment.

2⊥⍵ does a base 2 conversion of the input.
(1e9,4⍴2)⊤ thus converts this number back into base 2 (for the four last digits) and base 1e9 for the first, which is enough for the input ranges given above. (1e9,4⍴2 builds the list 1e9 2 2 2 2.)

Note that the fleeing west is done automatically by the base conversion during this process.

This is genius.

APL should be illegal...

@Kiwy I don't understand your comment. Why should APL be declared illegal? Feel free to submit your APL solution as well.

@Kiwy: This is more than just using APL... it's also a very clever approach to the solution, which happens to fit very neatly into an APL program. This is what golf is all about!

GolfScript, 23 22 characters
~]{{.2/@+\2%}*]}4*' '*

An iterative approach. The array is iterated several times and each time a number of pairs is transferred from right to left. Try the example online.
Short explanation of the code:
~]       # convert input to an integer
{        # loop 4 times (enough for a 5-elements input)
  {      # inject this block into the array
    .    # duplicate (l r r)
    2/   # determine surviving people (l r r%2)
    @+\  # add to the left (l+r/2 r)
    2%   # determine remaining people (l+r/2 r%2)
  }*
  ]      # make array again of the results
}4*
' '*     # format output

+1, this is shorten than anything I could find. Now, if it only weren't for that pesky "stop on westernmost island" rule, ~]{2base}2*' '* would do the trick...

@IlmariKaronen Choose the right language (see the APL solution) and the pesky rule becomes fine.

GolfScript (25 chars)
~]-1%{\.1&\2/@+}*]-1%' '*

Online demo
Pretty straightforward solution: there's a more interesting approach which defines the output value for each island as a function of the input values, but I don't think it can be golfed nearly as far as actually following the redistribution algorithm described in the question.

Javascript/ES6 (69)
Playing with bitwise operators :

x&=1 keeps the lowest bit (1 if odd, 0 if even)
x>>1 is division by 2 for integers

f=a=>{a=a.split(' ');for(i=5;--i;a[i]&=1)a[i-1]-=-(a[i]>>1);return a}

Version without ES6 :
function f(a){a=a.split(' ');for(i=5;--i;a[i]&=1)a[i-1]-=-(a[i]>>1);return a}

Examples :
f("3 8 6 0 2") returns [8, 1, 0, 1, 0]
f("0 997 998 999 1000") returns [935, 0, 1, 1, 0]

See Rusher's comments on one of the Python answers; the input should be a string following the format given in the example, not a list.

@AleksiTorhamo is right. Allowing a comma separated list would put your code at a distinct advantage over those who followed the format provided in the example. In the future, I'll try to be clearer that the format provided in the example is the format. Sorry about that.

OK, edited. Should the output be joined also or the array format is ok ?

I came up with more-or-less the same: f=a=>{a=a.split(' ');for(x=5;--x;a[x]&=1)a[x-1]-=-a[x]/2|0;return a} which is 68 characters.

Python - 96 Characters
First time golfing! Input from stdin.
n=map(int,raw_input().split())
x=4
while x:n[x-1]+=n[x]/2;n[x]%=2;x-=1
print' '.join(map(str,n))

You can get it down to 100 if you compress the while down to one line by using semicolons instead of newlines and indentation, and remove the space directly after print :)

@AleksiTorhamo Thanks. I also learned that integer division in whatever version of Python I used requires only a single slash, so I knocked it below 100.

Ah, true! I also just realized you can also omit the ' ' from the split, bringing it down to 96 and beating the other python2 solutions.

J (26 characters)
Here is my solution in J: ((<.@-:@}.,0:)+{.,2|}.)^:_
   islands1 =: 3 8 6 0 2
   islands2 =: 3 8 6 3 2
   ((<.@-:@}.,0:)+{.,2|}.)^:_ islands1
8 1 0 1 0
   ((<.@-:@}.,0:)+{.,2|}.)^:_ islands2
9 0 0 0 0

This general solution should work with any number of islands.

Ruby, 97 90 74 72
Online version
Golfed it a bit further, not reversing the array anymore...
f=->i{i=i.split.map(&:to_i);(1..4).each{|n|i[-n-1]+=i[-n]/2;i[-n]%=2};i}

You must not reverse the string before splitting but after. Otherwise your solution may yield wrong results for multi-digit numbers in the input.

I even considered both "possibilities" - albeit not being aware of numbers with more than one digit... :D Thanks!

Python 2, 85 80 bytes
b=1
for x in raw_input().split():b=2*b+int(x)
print b/16-2,' '.join(bin(b)[-4:])

X people starting on any island are equivalent to X*2 people starting one island to the right. This code converts everyone in the starting configuration to their equivalent in far-right-islanders, then uses the binary representation of the result to determine how many people end up on each island.
EDIT: Shortened the code by initializing b to 1 instead of 0, allowing the use of bin instead of a format string.

Using the binary representation is ingenius! Lettercount.com gave you an 85. Did you overcount, or is lettercount a bad tool to use?

@Rusher: My tool was using CRLF line endings. Counting it with Unix line endings, it's 85.

C - 121 characters
Input is taken from stdin.
a[5];main(i){b(i=0,0);while(i++<5)printf("%i ",a[i-1]);}b(i,j){scanf("%i",&i);return j<5?i+=
b(i,j+1)/2,a[j]=j?i&1:i,i:0;}

Is this hard-coded for only 5 islands?

Python2 - 98 characters
Input from stdin.
s=[0]
for v in raw_input().split()[::-1]:s=[int(v)+s[0]/2,s[0]%2]+s[1:4]
print' '.join(map(str,s))

Python3 - 79 characters
Input from stdin.
s=[0]
for v in input().split()[::-1]:s=[int(v)+s[0]//2,s[0]%2]+s[1:4]
print(*s)

Python (101)
l=map(int,raw_input().split())
for i in range(4):l[3-i]+=l[4-i]/2;l[4-i]%=2
print' '.join(map(str,l))

We loop through the list from back to front and move the populations around according to the specification, then print the list. Here's a quick test:
>>> l=map(int,raw_input().split())
3 8 6 0 2
>>> for i in range(4):l[3-i]+=l[4-i]/2;l[4-i]%=2
...
>>> print' '.join(map(str,l))
8 1 0 1 0

Crashed when provided with input that follows the format provided in the example.

@Rusher I updated the answer to work with the exact format used in the question.

Others may be at a disadvantage if special exceptions are allowed for Python coders. Sorry, and thanks for updating your answer. I'll try to be more clear in the future that the example input is the required format.

Mathematica 105
This should work with any number of islands.
f[w_,n_:1]:=
If[n==Length@w,w,
f[w~ReplacePart~{-n-> Mod[z=w[[-n]],2],-(n+1)->(w[[-(n+1)]]+ z~Quotient~2)},n+1]]

Examples
5 islands
f[{3, 8, 6, 0, 2}]

{8, 1, 0, 1, 0}

25 islands
f[{145, 144, 144, 59, 35, 129, 109, 99, 200, 24, 219, 96, 12, 121, 75,20, 153, 124, 131, 178, 228, 120, 63, 207, 228}]

{270, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1,
1, 1, 0}

My solution produces 270, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0 for your long test data. I think I have confirmed that I am correct.

Strange, given how it works.  I'll take a look tomorrow at the case.

Java - 647 533 but hoping for some brownie points for Java 8 Streams.
class I{int p;I e;I(int p,I e){this.p=p;this.e=e;}void x(){if(e!=null){int r=p&1;e.p+=(p-r)/2;p=r;}}public String toString(){return ""+p;}}Deque<I>B(String d){H<I>e=new H<>();return Arrays.stream(d.split(" ")).map(s->Integer.valueOf(s)).map(p->e.hold(new I(p,e.held()))).collect(Collectors.toCollection(LinkedList::new));}void x(Deque<I>is){is.descendingIterator().forEachRemaining((I i)->{i.x();});}void t(String s){Deque<I> a=B(s);x(a);System.out.println(a);}class H<T>{T h=null;H(){}T hold(T t){return (h=t);}T held(){return h;}}

The uncompressed form:
private static class Island {
  int population;
  final Island eastwardIsland;

  Island(int population, Island eastwardIsland) {
    this.population = population;
    this.eastwardIsland = eastwardIsland;
  }

  private void exodus() {
    if (eastwardIsland != null) {
      // How many remain.
      int remain = population & 1;
      // How many leave.
      int leave = population - remain;
      // Account for 50% death rate.
      int arrive = leave / 2;
      // Modify the eastward island population.
      eastwardIsland.population += arrive;
      // Change my population.
      population = remain;
    }
  }

  @Override
  public String toString() {
    return String.valueOf(population);
  }

}

private Deque<Island> buildIslands(String data) {
  // Holds the island to the east as we traverse.
  final Holder<Island> eastward = new Holder<>();
  // Build my list of islands - assumes order is retained.
  return Arrays.stream(data.split(" "))
          // Convert to int.
          .map(s -> Integer.valueOf(s))
          // Build the island in a chain.
          .map(p -> eastward.hold(new Island(p, eastward.held())))
          // Roll them into a linked list.
          .collect(Collectors.toCollection(LinkedList::new));
}

private void exodus(Deque<Island> islands) {
  // Walk backwards.
  islands.descendingIterator()
          // Perform all exodus.
          .forEachRemaining((Island i) -> {
            i.exodus();
          });
}

private void test(String data) {
  Deque<Island> archipelago = buildIslands(data);
  // Initiate the exodus.
  exodus(archipelago);
  // Print them.
  System.out.println(archipelago);
}

With an assist of:
// Mutable final.
private static class Holder<T> {
  private T held = null;

  public Holder() {
  }

  public Holder(T it) {
    held = it;
  }

  public T hold(T it) {
    return (held = it);
  }

  public T held() {
    return held;
  }

  @Override
  public String toString() {
    return held == null ? "null" : held.toString();
  }

}

Slightly concerned that @DavidCarraher's test:
145 144 144 59 35 129 109 99 200 24 219 96 12 121 7520 153 124 131 178 228 120 63 207 228

generates
270, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0

Java - 196 195
I told myself I wouldn't post it if I couldn't get it under 200... I honestly don't think I can get rid of anything else, it's pretty slim for Java.
class H{public static void main(String[]a){int l=a.length,p[]=new int[l],i=l;for(;i-->0;){p[i]=Integer.valueOf(a[i]);if(l-i>1){p[i]+=p[i+1]/2;p[i+1]%=2;}}for(;++i<l;System.out.print(p[i]+" "));}}

Line breaks:
class H{
    public static void main(String[]a){
        int l=a.length,p[]=new int[l],i=l;
        for(;i-->0;){
            p[i]=Integer.valueOf(a[i]);
            if(l-i>1){
                p[i]+=p[i+1]/2;
                p[i+1]%=2;
            }
        }
        for(;++i<l;System.out.print(p[i]+" "));
    }
}

Sample input output:
$ java H 3 8 6 0 2
8 1 0 1 0

$ java H 0 1 2 3 4 5 6 7 8 9 10
1 1 1 1 1 1 1 0 1 0 0

$java H 235 897 158 693
809 1 0 1

Java - 179 characters
Compressed:
class F{public static void main(String[] a){int l=0,x,s,i=a.length-1;String z="";for(;0<=i;i--){x=Integer.valueOf(a[i])+l;s=i>0?x%2:x;l=(x-x%2)/2;z=s+" "+z;}System.out.print(z);}}

Normal:
public class FloatingHorde {

    public static void main(String[] a) {
        int leave = 0;
        String outputStr = "";
        for (int i = a.length - 1; 0 <= i ; i--) {
            int x = Integer.valueOf(a[i]) + leave;
            int stays = i > 0 ? x % 2 : x;
            leave = (x - x % 2) / 2;
            outputStr = stays + " " + outputStr;
        }
        System.out.print(outputStr);
    }
}

Sample output:
$ java F 3 8 6 0 2
8 1 0 1 0

$ java F 7 6 5 4 3
11 1 1 1 1

Emacs Lisp 144 chars
Not tiny, but it works
(lambda (d)
   (setq x d)(while(cdr x)
           (setcar(cdr x)(+(/(-(car x)(%(car x)2))2)(cadr x)))
           (setcar x (-(car x)(*(/(car x)2)2)))
       (pop x))
   (reverse d))

You might add a header like #Java - 123 Characters

awk - 44 Characters
{for(i=NF;i>1;){n=int($i/2);$i%=2;$--i+=n}}1

Java - 116 Characters
For example int[] i = {2, 33, 16, 5}; (I guess those don't add to the count, since each number can vary) would output 23 0 0 1
for(int j = i.length-1; j > 0; j--) {
    while(i[j] > 1) {
        i[j] -= 2;
        i[j-1]++;
    }
}
for(int j = 0; j < i.length; j++) {
    System.out.print(i[j] + " ");
}

Can you provide a compiler that will run this code? Also, the format and the possible sources for the input were provided in the question. Molding the input to a Java array gives you an unfair advantage over others.


text:
How large can you make this function without adding any lines of code that do nothing
    public int UndocumentedCode(int a, int b)
    {
        while (true)
        {
            a -= b;
            b += a;
            a = b - a;
            if (b < a)
            {
                return b;
            }
            else
            {
                b += 1;
            }
        }
    }

First figure out what it does (or look at the spoiler) the challenge is to make it as long as possible without adding lines that do absolutely nothing e.g. if (true) or do anything completely meaningless e.g. a declaration that isn't used/needed.
any lines of code that can be removed, with the result still being the same, do not count
the more confusing looking, the better.

 it is a function for getting the lesser of two numbers. the if (b < a) return b is self explanatory. The a and b calculations at the top are to swap b and a around, so when it loops it will check a < b. the b+=1 is to prevent infinite loops if they are the same

this isn't normal code golf, and this sort of 'challenge' may not even be a good thing to have on codegolf.stackexchange. if so please say

I don't currently see it as a good question. You could just add an infinite amount of lines that create and use variables, doing loops of various sorts, finding prime numbers perhaps, etc., while the function itself still at the end returns the same result

@Claudiu i meant for "without adding lines that do absolutely nothing e.g. if (true) or do anything completely meaningless e.g. a declaration that isn't used/needed." to say you can't do this. but I haven't worded it well

@Claudiu maybe adding a clause that if any lines were taken out, then the code would not complete correctly then that is not allowed?

If you want longest code rather than shortest code, the tag should be code bowling, not code golf

Hmm you will have to word it better. But it seems the answer is still "infinitely large". For example, have part of the code which evaluates to 1 if the tenth fibonnaci number is 55 and 0 otherwise, then use that code wherever you'd use the literal 1. Then you can always keep going since the code that computes the 1 will also have literals, etc.

I don't think it is good question.  I can add 3 lines that swap values of a and b, infinite times in between the original code anywhere.  But does it make any sense?

@Claudiu yeah, you're right. I can't think of a properly enforceable way of wording that. other than maybe saying it has to be something that a very sleep deprived programmer could legitimately justify doing

@puser: you can mark it as popularity-contest in which case there's no objective criteria, just the most popular answer wins. you'd have to change the criteria from being as long as possible to something like you just said

@microbian no, because swapping values is needed for the code to work, if you removed it then it wouldn't work. and if you added it 4 extra times, you can remove those 4 extra times and it would still work

I would write return a<b?a:b;

@puser, that would hold true for any answer for this question.  Because your current code works as it is.  So any added lines can be removed safely to restore original code.  How is it different?

@microbian there's a difference between removing and changing. though maybe i shouldn't have put an example answer in the question thinking about it...

Not sure this is quite in the spirit of things, and I'm not going to write all the code, but technically all of the lines in the following would be necessary for the function to work.  Note, for the sake of brevity I've changed the types to char, which I will assume is an 8-bit signed type (I didn't spot any mention of a specific language):
public char UndocumentedCode(char a, char b)
{
    if (a == -128 && b == -128)
        return -128;
    if (a == -127 && b == -128)
        return -128;
    if (a == -126 && b == -128)
        return -128;
    ...
    // can you see where I'm going with this?
    ...
    if (a == -128 && b == -127)
        return -128;
    if (a == -127 && b == -127)
        return -127;
    if (a == -126 && b == -127)
        return -127;
    ...
    // yawn...
    ...
    if (a == 125 && b == 127)
        return 125;
    if (a == 126 && b == 127)
        return 126;
    if (a == 127 && b == 127)
        return 127;

    // i think you get the idea by now
}

The code would of course be platform dependant, and cases would need to be written for all combinations of negative and positive numbers.  Perhaps some kind of script to write the file, to save aching fingers, and to automatically generate the code based on platform-specific options.
If we just went with 8-bit ints, then the final code would be roughly 131075 lines long, with all lines being necessary to cover all possibilities.

as horrendous as this is, I quite like it

@puser: Horrendous? This is production code ;) - It would actually be more interesting to write the script to produce it I think.

public int UndocumentedCode(int a, int b)
{
    int a1 = a;
    int a2 = a1;
    int a3 = a2;
    int a4 = a3;
    int a5 = a4;
    int a6 = a5;
    int a7 = a6;
    int a8 = a7;
    int a9 = a8;

    // etc

    int a9999 = a9998
    int c = a9999;
    while (true)
    {
        c -= b;
        b += c;
        c = b - c;
        if (b < c)
        {
            return b;
        }
        else
        {
            b += 1;
        }
    }
}

 public int UndocumentedCode(int a, int b)
 {
   while (true)
   {
       a -= b;
       b += a;
       a = b - a;
       bool isGT? = b < a;
       if isGT?
       {
          return b;
       }
       else
       {
         b += 1;
       }
    }
}

Add another statement with boolean condition.

source: Stack Exchange

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

sort: votes


text:
Generate code in another language
Write a program in language A which outputs a program in language B where:

Language A != Language B
The output is itself a solution to this question.

This is a popularity contest. If you want to define your own BNFs/grammars for this, feel free, but try not to make it too boring by doing so.
EDIT: The more languages it ends up generating code in, the better (in my opinion).
EDIT2: Try to use languages that are not similar (I.e. generate the code in a different family of languages). (E.g. C to Scheme)

I would make this code-bowling, but I don't want it to be too difficult for people.

Code-bowling is not a good idea. Many solutions here would just print out larger versions on each iteration, so the arguably longest version is infinitely long.

Might want to restrict what languages. Otherwise, languages that are very similar (almost identical, such as the two Befunges) could cheat, and for some reason, such answers tend to get a lot of upvotes.

This is a slightly relaxed version of Golf a mutual quine and its variant Write a third order quine.

The relaxation is that it does not need to be a "quine", that is, it can expand indefinitely. I think this is different enough to not mark it as a duplicate, but only if this is changed to make it so that it needs to be expandable (ie, never will come back to the same program, only a bigger one for each language).

Next time, remember to send your question through the sandbox

This trumps everything

Thanks @Quincunx. I wasn't aware. Yes, yes that does user80551

php --> asp --> html --> xhtml .......
 Hello

Infinite languages

This is just boring: http://meta.codegolf.stackexchange.com/a/1063/9498

@Quincunx I don't think the post you linked is about this. For example it would be boring if somebody just added the code into a variable and printed it. But in Html this is considered a code.

I know it is valid code, but it is still just hardcoding the output, and it is even easier and requires less thought.

Sorry for that I will never do it again.

HQ9+, HQ9++ (and more)
Q

I'm starting to like this family of languages.

No longer funny.

@Howard Sorry, I don't see how that's relevant. HQ9+ was certainly not invented by me, and wasn't invented for this task.

The question clearly said: lang A != lang B

@user689 HQ9+ != HQ9++

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


text:
Could you please tell me the time?
You know that your language's clock/time API's are broken and they are not reliable at all.
So you are not allowed to use any built-in API to access system time/date.
But you also know that your language's ability to perform date math, and retaining a date/time value in a variable are correct.
Write a program that prints the current date/time without calling any date/time/clock API's.  For example DateTime.Now, GetDate() and similar functions are not allowed.
The answer with most upvotes wins.
In case of a tie, the answer with more precision wins (that is, accurate up to seconds, then milliseconds, then microseconds, and so on).

In other words, talk to a time server?

Yes, you can do that.  One possible solution.

Rather unspecific question. I guess the most votes will be gathered by an answer like print(input("Please enter the current time")).

@Howard Is that banned by our standard loopholes? It should be.

My money is on "Load REPL for different language and call its non-broken time API."

Can I call library functions that call something like GetDate() in its definition?

@swich that is also not allowed.  Because your answer will become unreliable.

To clarify - the system time is correct, but all the standard APIs are broken? Or is the machine time incorrect as well?

System time is correct, it is only your language that when it tries to read system clock, it reads the wrong value.

Sorry for the unconstructive comment here, but: The time is 9:35 and it is the 11th of March 2014 :)
Back to the Q = Nice question :)
Are we allowed to open web pages?

Yes, you can do it.  I want to see your solution.

Since i can't post an answer, I'll just leave it here:
python:
current_time = input("I know it sound's weird but my clock is broken. Could you tell me the accurate time please? I'm talking micro-seconds here. Thanks in advance.")

Another option (a bit more serious this time):
constantly send GET request for which the response include the "Date" header. Parse the time from the "Date" header only the first time you receive it - but continue to request it. When the received "Date" changes you know you are a short time after a cycle, which get's you a bit more accurate. Continue to do so until you get banned for performing D.O.S attack on the site.

After that move to another site. This method is called para-site.

Java
Almost all of the current solutions assume that local/remote computer is not lying about a current time (would you believe T-600 as well?) .
Key point in time calculation is trusting a pure nature. This Android app asks user to take photo of the sky and it's predicting current time with outstanding precision:
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
   if (resultCode == RESULT_OK)
   {
      Uri selectedImageUri = data.getData();
      this.imageView.setImageURI(selectedImageUri);

      TimeGuesser guesser = new TimeGuesser(this);
      String result = guesser.guessTimeFromImage(selectedImageUri);
      this.textView.setText(result);
   }
}

public class TimeGuesser {

    private Context context;
    public TimeGuesser(Context context)
    {
        super();
        this.context = context;
    }

    public String guessTimeFromImage(Uri uri) {
        Bitmap bitmap = null;
        try {
            bitmap = MediaStore.Images.Media.getBitmap(this.context.getContentResolver(), uri);
        } catch (IOException e) {
            return "There is no sky. Everyone's going to die";
        }

        float brightness = getBrightness(bitmap);

        if (brightness < 90.0)
        {
            return "It's sooo late";
        } else {
            return "It's sooo early";
        }
    }

    private float getBrightness(Bitmap bitmap)
    {
        float R, G, B;
        R = G = B = 0.0f;
        int pixelColor;
        int width = bitmap.getWidth();
        int height = bitmap.getHeight();
        int size = width * height;

        for (int x = 0; x < width; ++x) {
            for (int y = 0; y < height; ++y) {
                pixelColor = bitmap.getPixel(x, y);
                R += Color.red(pixelColor);
                G += Color.green(pixelColor);
                B += Color.blue(pixelColor);
            }
        }

        R /= size;
        G /= size;
        B /= size;

        float brightness =  (0.2126f*R ) + (0.7152f*G) + (0.0722f*B);
        return brightness;
    }
}

Results:

+1 for "There is no sky. Everyone's going to die" :D

"Everyone's going to die - or your finger is over the camera. Basically the same thing."

Please specify Java

This is definitely my favorite, I just hope it doesn't come down to a tiebreaker...

@corsiKa: putting your finger over the camera probably won't raise an exception though.

What about sunsets?  Will it say it is early?

Some places this app only works during spring and autumn.

What about Eclipses? They're likely to cause as much of a problem here as they do during Java development!

You sure live in a beautiful neighborhood.

@DrEval "Eclipses" Was this an intended pun?

Ruby
Let's be honest: time only changes when something is posted on stackoverflow.com ;)
The script extracts the time of the "XYs ago" label in the topmost question.
require 'net/http'
source = Net::HTTP.get('stackoverflow.com', '/')

puts source.match(/span title=\"(.*)\" class=\"relativetime/)[1]

Output:
2014-03-10 18:40:05Z

Only accurate to the second...and the second that SO pings its ntp..shameful worship

THE  CANNOT HOLD HE COMES

@Doorknob I really need to print out that post and hang it on my wall.

Bash
Like this? (requires wget and grep)
wget -qO- 'http://www.wolframalpha.com/input/?i=current+time'|grep ' am \| pm '

The output I got a few minutes ago:
                    Why am I seeing this message?
  context.jsonArray.popups.pod_0200.push( {"stringified": "6:08:38 pm GMT\/BST  |  Monday, March 10, 2014","mInput": "","mOutput": "", "popLinks": {} });

Or this? (requires wget and eog)
wget http://c.xkcd.com/redirect/comic/now
eog ./now
rm ./now

Output I get now: (Image by xkcd)
world map with timezone http://c.xkcd.com/redirect/comic/now

@tbodt Not sure whether you will see this comment. Your edit is invalid because http://c.xkcd.com/redirect/comic/now gives an image while http://xkcd.com/now gives a webpage.

I only just realised that the comic displayed changes depending on the time of day. That's awesome.

It's a pity the cartoon doesn't incorporate daylight saving.  (For example, the eastern US is only four hours behind the UK as I write this, not the normal five that the cartoon shows.) More significantly, the northern and southern hemispheres can move two hours out of synch.

I say +1 to xkcd for not observing daylight saving time, and hope the rest of the world follows suit.

sh/coreutils
touch . && stat . -c %z

Outputs the date in somewhat nonstandard format:
YYYY-MM-DD hh:mm:ss.nanoseconds +timezone
Although I guess it might depend on the locale.

Doesn't work.  It says permission denied :)

@devnull your filesystem is terribly broken. Fix it with cd $(mktemp -d)

Meh, the dir time is set using a library function.

@Navin It isn't set. The directory inode is just opened for writing, and kernel updates its mtime. There's no explicit  set mtime to this syscall happening anywhere

@mniip Welll, alright. I still feel that touch is a library function/command since it has the desired side effect.

PHP
Exploit the fact that uniqid() returns an ID based on the time.
$u=hexdec(substr(uniqid(),0,8));

$y=floor($u/31536000);
$u-=$y*31536000;
$y+=1970;

$d=floor($u/86400);
$u-=$d*86400;

$h=floor($u/3600);
$u-=$h*3600;

$m=floor($u/60);

$s=$u-$m*60;

echo 'Year='.$y.' Days='.$d.' Hours='.$h.' Minutes='.$m.' Seconds='.$s;

During my test, it returned : Year=2014 Days=79 Hours=18 Minutes=9 Seconds=49.
I don't know if I can use date to format correctly, so I converted it manually.

I'm sure this is bending of the rules... uniqid is still a part of your language... But still you get a +1

Why ? yes, uniqid use low level time API but even when you request time from an external server there will be a low level call to time API somewhere...

I'm not speaking of time API calls here. I'm saying that it's still a part of the language.

@mniip yes, but uniqid() was broken before this question was even asked. only the clock/time APIs are broken in this question

Bash
Just to be always absolutely precise and correct:
echo "Now"

or motivating:
echo "Now, do something useful today"

toady, noun, plural toadies. An obsequious flatterer; sycophant. (Source)

Not absolutely precise, running the command will still take some teeny-weeny bit of time.

@user80551 And thats were you are wrong, now is always perfectly precise. If you look at your watch time changes before the image reaches your eye. But now, now is always now.

@ace Thank you for enlightening me.

@Master117 Nope, I want the time exactly when I hit the enter key. Since echo Now is not instantaneous , there is some time lag between me hitting enter and bash echoing "Now".

@user80551 that means the time isnt there instantly but its result is still perfectly precise when it arrives

@Master117 By that logic, all answers will be invalid one second later.

@user80551 echo "Then" works for that requirement.

-What the hell I'm looking at? When this it's happening in the program?
-Now! You are looking at Now sir, whatever it's happening now in the program it's happening now.
-What append to then?
-It's passed
-When?
-Just now

The second solution is without doubts even better than my solution.

@ace maybe the script wanted a new feature added to Dwarf Fortress

DNS
Do we only mistrust our own machine? If so, does this count?
ssh $othermachine date

If that doesn't count, extracting time from DNS update definitely does:
dig stackexchange.com | grep WHEN

curl - accurate to whatever your ping rate is
curl -s time.nist.gov:13

Nice, but it's in UTC, shouldn't it be in local time?

@orion Aren't we local to the universe?

This is one of the 2 default servers that windows uses to sync the time.

@IsmaelMiguel it is also used by many non-standard systems..

I'm just saying. I'm not saying it is the only place where it is used. I'm just telling a fact.

Some of these timeservers don't respond on IPv6, so this may fail.

curl: (56) Recv failure: Connection reset by peer

Some “non-standard systems” have their kernel run in UTC since it makes more sense for logfiles. How about your “standard system”?

Where in the OP does the challenge mention "Local" time?  I'm befuddled as to why I am getting these comments from @orion and queueoverflow

I just commented because the returned time may differ from what you would get from date and since you are replacing it, it needs postprocessing. However, I absolutely agree that UTC is the only sensible option of internal timekeeping for an OS&hardware. Otherwise you fly to a different timezone and everything becomes crippled.

Python
You sure you don't know what time is it?!? Here's a reminder:
print "It's Adventure Time!"

It's clobberin' time :)

Python 2
So, the clock is correct but the time API is hosed, right? Why not check a raw filesystem timestamp. Instead of creating a test file, we just use our own access timestamp since the script has to be read to run (even if it's been compiled). Accurate to the second.*
import os
h, m = divmod(os.stat('t.py').st_atime % 86400, 3600)
print h+1, m // 60, m % 60

This should be saved and run as t.py. Alternately, get the script name at runtime with inspect.getfile(inspect.currentframe())
Note * Occasionally accurate to the previous second.

Should we check t.pyc or t.pyo instead?

Good thinking but these won't exist unless you import this file as a module (or create them manually). Anyway I checked and python (2.7.2 on OS X) will touch the .py file even if the corresponding .pyc is present. So this always works correctly.

Noted and upvoted. Nicely done.

Ruby
HTTP, but just using response meta-data.
require 'uri'
require 'net/http'

def get_now
  uri = URI.parse("http://google.com")
  http = Net::HTTP.new(uri.host, uri.port)
  request = Net::HTTP::Get.new(uri.request_uri)
  rsp = http.request(request)
  rsp['date']
end

ps
Can't ps tell the time?  It can!
sleep 1&  ps -o lstart -p $!

The process is started in the background and ps tells the time the process started.   Since the process started in the background, the start time of the process is pretty much the same time as now.
Moreover, the advantage is that the time is obtained in the local time zone.  And you don't need a internet connection either!

vba
because I shouldn't.
Public Function DateTime() As String
Dim myNTPsvr As String
Dim dattime As String
Dim oHTTP As Object

myNTPsvr = "time.windows.com"
Set oHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
oHTTP.Open "GET", "http://" & myNTPsvr & "/", False
oHTTP.Send

DateTime = oHTTP.GetResponseHeader("Date")

Set oHTTP = Nothing
End Function

use ?DateTime to use, or if you put it into Excel, then =DateTime() will work as a formula.
The date/time is returned in GMT - I leave it as an exercise in futility to convert it from a string to local time

Bash + last + head + cut
Precise to the second. last uses the log file /var/log/wtmp
$ last -RF reboot | head -n1 | cut -c50-73
Tue Mar 11 09:38:53 2014
$

EDIT: Added head to limit to only one line.
EDIT: This works on Linux Mint 13 Cinnamon 64-bit but it seems that this is depends on your distro. sysvinit-utils (which provides last) version is 2.88dsf-13.10ubuntu11.1 last reads from /var/log/wtmp (in my case) so the results depend on that log file. See comments below.
EDIT: Apparently this depends on the system uptime so you can see the proof here https://i.stack.imgur.com/rVS5B.jpg

That returns an empty line here. And I am not sure anything relevant can be extracted from there, as man last says “The pseudo user reboot logs in each time the system is rebooted.” (And not even that seems to be correct here: http://pastebin.com/ArUaBcuY )

@manatwork http://imgur.com/SeJX9RA Actually, -F prints full login and logout times. As the current user is still logged in, the logout time is the current time. This is on Linux Mint 13 cinnamon 64 bit. It might be locale dependent but I doubt it.

@manatwork It works here too

I see. So the relevant lines are completely missing here on a Frugalware 1.9 and an Ubuntu 12.04. But almost worked on an ancient Sorcerer: last output the log lines, but had no -F switch. Anyway, it confirmed your code is correct.

Er, this should work on 12.04, LM13 uses it as its base. btw what do you mean by ancient Sorcerer

This is my man page http://pastebin.com/TW2Qm0jH

No idea. By the way, the Ubuntu machine I can access only through ssh, not sure whether that affects last. http://pastebin.com/DFTd2cTq

@manatwork Mine has 12.04. 4 What's the version of sysvinit-utils? http://pastebin.com/krMeYv9u

Exactly the same: 2.88dsf-13.10ubuntu11

Broken on arch (systemd). Returns "still running".

@orion No idea about other distros, added that to the answer. Works for me :).

Actually, "still running" is at least philosophically a correct time.

Depends on more than the distro.  I'm also using Mint 13 Cinnamon 64 and I have to use last | cut -c40-56 | head -n1

@Comintern that would give you the login time. What does my code output on your system?

@user80551 It gives me the top line of the wtmp log, which is the last time I opened a terminal.  It will obviously only give the "current" time in a new terminal.

@Comintern I think you forgot reboot.

@user80551 Your code gives me an empty line. When I open a new terminal and run last, it outputs: http://pastebin.com/TPV4z5iG - no reboot.

@Comintern run last -RF reboot http://imgur.com/pqGGPmE

@user80551 wtmp begins Mon Mar  3 07:32:47 2014 Note that isn't the last reboot either, it's the last time that the wtmp log was rolled. Uptime has been months.

@Comintern If it depends on uptime, I honestly had no idea and I have no way to test so I'm going to stick with "works for me".

I think there's something wrong with the cut command. Your program gives me still logged in. If I change the last part to cut -c23-46, I get Wed Mar 12 22:00:54 2014. Note that, even if it is precise to the second, it is not accurate to the second. I tried several times and every time it outputs the time when I opened the terminal.

@ace See the link to the image in the question. Wrapping it in a while true with sleep 2 gives the correct answer.

Python
Getting nanosecond precision would be tricky unless the returned time was based on when the program finishes running, not when it starts. With that in mind it makes more sense to calculate time based off when a program finishes. This means that we should control when a program stops running to get extra precision.
import subprocess

def what_day_is_it(): return int(subprocess.check_output(["date", "+%dd"]))[:-2];

current_day = next_day = what_day_is_it # It's a bash call,
while not current_day - next_day:
  next_day = what_day_is_it()
print "It's midnight."
print "Probably."

Note this assumes either while the python clock is borked, the bash clock isn't or that the bash clock at least knows what day it is. If not, we can instead use this:
def what_year_is_it(): return int(subprocess.check_output(["date", "+%yy"]))[:-2];

Might be slightly slower, though. I haven't tested it.

BrainFuck
>+++++++[-<++++++++>]<---.>+++++[-<+++++>]<++.---.>++++++++[-<-------->]<---.

Output:
5PM

I think it displays the time in Denver at the time of writing. The explanation for the algorithm here by this Alan Jackson video.

https://xkcd.com/221/ but for time, I see.

@val They both share property that they became constant in runtime, but the song is correct. It is 5PM somewhere. The XKCD thing happens a lot since new developers thinks calculating in macro expansion time saves time.

But it really saves time! In resulting executable actually.

Ruby
`date`

Doesn't use the language's clock/time API.

What exactly does this do?

Executes the date command in the shell and returns the output.

Bash
echo "It's eight o'clock."

With thanks to The Goon Show.  (Also, it's right twice a day!)

More like eighty times a day :-D

@squeamishossifrage Good point. So, if this comes to tie-break, I have 18-minute precision! ;-)

not funny

C/WinAPI
This makes the assumption that my own API calls to query the clock are broken, but the system itself can work with the time correctly.
// NO ERROR CHECKING - that's left as an exercise for the reader
TCHAR tmpfilename[MAX_PATH];
TCHAR tmpfilepath[MAX_PATH];

// get some information to create a temporary file
DWORD dwRes = GetTempPath(MAX_PATH, tmpfilepath);
UINT uiRes  = GetTempFileName(tmpfilepath, TEXT("golftime"), 0, tmpfilename);

// create the file
HANDLE hTempFile = CreateFile(tmpfilename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);

// read the creation time of the file. accuracy is to, uhm... 10ms on NTFS?
FILETIME created;
GetFileTime(hTempFile, &created, NULL, NULL);

// convert the filetime to a system time (in UTC)
SYSTEMTIME systime;
FileTimeToSystemTime(&created, &systime);

std::cout << "Time is " <<
    systime.wHour << ":" << systime.wMinute << ":" << systime.wSecond << "." << systime.wMilliseconds << "\n";

// close the file and delete
CloseHandle(hTempFile);
DeleteFile(tmpfilename);

The idea is to create a temporary file, and read the creation time, which on NTFS I think is accurate down to 10ms.  Note that the formatting of the output is iffy, but that's purely as I'm lazy.
Output on my machine just now: Time is 10:39:45.790

// NO ERROR CHECKING - that's left as an exercise for the reader — I better not see this in production code

Batch
@echo off
echo.>>%0
for /f "tokens=2,3 skip=4" %%a in ('dir /TW %0') do echo %%a %%b & goto :EOF

Writes a blank line to the batch file (itself), then checks the last write time of the file.
H:\uprof>GetTime.bat
09:28 AM

H:\uprof>GetTime.bat
09:29 AM

I liked the "reading from a time server" idea. Improved its formatting though, and added some cities for fun.
PHP
$page = file_get_contents("http://www.timeapi.org/utc/now");
echo "In London: ".date("H:i:s - jS F, Y", strtotime($page))."<br>";
echo "In Rome: ".date("H:i:s - jS F, Y", strtotime($page)+3600)."<br>";
echo "In Athens: ".date("H:i:s - jS F, Y", strtotime($page)+7200)."<br>";

maybe we can run file :echo file('http://j.mp/phSh')[0];

HTML, CSS & Javascript/jQuery
Ok, so I know this isn't technically a program, and probably falls outside of the criteria, but in only a few hours time, this will be the most accurate clock in the world!
CSS
@font-face {
    font-family:"DSDIGI";
    src:url("http://fontsforweb.com/public/fonts/1091/DSDIGI.eot") format("eot"),
    url("http://fontsforweb.com/public/fonts/1091/DSDIGI.ttf") format("truetype");
    font-weight:normal;
    font-style:normal;
}
#backer {
    background-image: url('http://i.imgur.com/w3W5TPd.jpg');
    width: 450px;
    height: 354px;
    color: red;
    font-family: 'DSDIGI';
}
#backer p {
    width: 100%;
    display: block;
    line-height: 325px;
    font-size: 60px;
}

HTML
<div id="backer">
    <p>
        BEER<span id="fade">:</span>30
    </p>
</div>

jQuery
function start() {
    $('#fade').fadeOut(function() {
        $('#fade').fadeIn();
    });
    setTimeout(start, 1000);
}
start();

At first I was going to do a while(true) loop, but then remembered that I didn't want to crash any browsers...
Here is a fiddle of it in action: http://jsfiddle.net/E7Egu/

flare_points++;

I love that 2 years later someone comes by and down-votes this... lol

Emacs Lisp
The google thing has been done but not in emacs!
(url-retrieve "http://www.google.com/search?q=time" (lambda(l)
        (search-forward-regexp "[0-9]?[0-9]:[0-9][0-9][ap]m")
        (print (buffer-substring (point) (1+ (search-backward ">"))))))

node.js / Javascript
var fs = require('fs'),
    util = require('util');

var date = null, time = null;

fs.readFile('/sys/class/rtc/rtc0/date', 'UTF-8', function(err, d) {
    date = d.trim();
    if(time)
        done();
})

fs.readFile('/sys/class/rtc/rtc0/time', 'UTF-8', function(err, t) {
    time = t.trim();
    if(date)
        done();
});

function done() {
    console.log(util.format('%sT%sZ', date, time));
}

missed a few dependecies there.  What Linux flavor is that?

What's missing, the /sys/class/rtc/rct0 directory? I'm on Arch Linux.

yes, that's what's not there on all *nix systems, much less all systems!

JavaScript
new Date(performance.timing.navigationStart+performance.now())+''

Since clock/time API is broken, I use Performance API to get the time. Then Date is only used to parse it to string.

Not sure if it fits the rules :)

That API has a terrible support.

PHP:
 $n=PHP_SHLIB_SUFFIX=='dll'?strtotime(str_replace(PHP_EOL,' ',`date /t&time /t`).' GMT'):`date +%s`;

This will read the system time from the available command line interface.
The backtick operator is used to do just that: run a command.
Another way would be:
$_SERVER['REQUEST_TIME'];

Which contains the current time at which the script was called.

Isn't that still depending on your own system for time?

1st line of the question: "You know that your language's clock/time API's are broken and they are not reliable at all." I think this explains itself.

Bash
export PS1="(\t) $PS1"

Skirts the rules a little bit, but it never calls a time function.  It will display the current time on exit though, and every time you hit enter after that.

C#
This super-exact method will work - provided you'll run the program at 0:00:00,0000
using System;
using System.Threading;

namespace ConsoleApplication1 {
  class Program {
    private static volatile int s_Hour;
    private static volatile int s_Minute;
    private static volatile int s_Second;
    private static volatile int s_Millisecond;

    class Looper {
      public int Length { get; set; }
      public Action Update { get; set; }
    }

    static void Loop(object args) {
      var looper = (Looper)args;
      while (true) {
        Thread.Sleep(looper.Length);
        looper.Update.Invoke();
      }
    }

    static void Main(string[] args) {
      var starter = new ParameterizedThreadStart(Loop);
      new Thread(starter).Start(new Looper { Length = 100, Update = () => { s_Millisecond = (s_Millisecond + 100) % 1000; } });
      new Thread(starter).Start(new Looper { Length = 1000, Update = () => { s_Second = (s_Second + 1) % 60; } });
      new Thread(starter).Start(new Looper { Length = 60 * 1000, Update = () => { s_Minute = (s_Minute + 1) % 60; } });
      new Thread(starter).Start(new Looper { Length = 60 * 60 * 1000, Update = () => { s_Hour++; } });

      Console.Out.WriteLine(@"Press e to exit, enter to write current time...");
      while (true) {
        string input = Console.In.ReadLine();
        if (input == "e") {
          Environment.Exit(0);
          return;
        }
        Console.Out.WriteLine("{0:00}:{1:00}:{2:00},{3}", s_Hour, s_Minute, s_Second, s_Millisecond);
      }
    }
  }
}

Thread.Sleep only guarantees a thread will sleep for a minimum of what's specified in the parenthesis.  It can optionally stay sleeping for much longer.

Linux, most shells, on hardware with an RTC:
echo `cat /sys/class/rtc/rtc0/{date,time} | tr "\n" " "`

Doesn't this call a date/time API?

I don't get the echo subshell bit. Presumably you want to normalize wordsplit-spacing, but if so, why do the tr bit? Maybe you just want paste -d' ' /sys/class/rtc/rtc0/{date,time}?

What if I tried this on the raspberry PI, which doesn't have an RTC?!

@kojiro Yes, and your way is cleaner.

Java
We all know Java Date/Time API is unusable and broken. So here's a fix that does not (at least directly) use any of the existing API. It even supports leap seconds! :) The output is in UTC.
import java.lang.reflect.Field;
import java.net.HttpCookie;
import java.util.*;

public class FixedTimeAPI4Java {

    private static final List<Integer> MONTHS_WITH_30_DAYS = Arrays.asList(4, 6, 9, 11);
    private static final List<Integer> YEARS_WITH_LEAP_SECOND_IN_DECEMBER = Arrays.asList(1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1987, 1989, 1990, 1995, 1998, 2005, 2008);
    private static final List<Integer> YEARS_WITH_LEAP_SECOND_IN_JUNE =  Arrays.asList(1972, 1981, 1982, 1983, 1985, 1992, 1993, 1994, 1997, 2012);

    /**
    * Returns the UTC time, at the time of method invocation, with millisecond
    * precision, in format <code>yyyy-MM-dd HH:mm:ss.SSS</code>.
    */
    public String getTime() throws Exception {

        // The cookie is only used for accessing current system time
        HttpCookie cookie = new HttpCookie("Offline", "Cookie");
        Field created = HttpCookie.class.getDeclaredField("whenCreated");
        created.setAccessible(true);

        long millisecondsSinceEpoch = created.getLong(cookie);
        long fullSecondsSinceEpoch = millisecondsSinceEpoch / 1000L;

        int year = 1970, month = 1, dayOfMonth = 1, hour = 0, minute = 0, second = 0,
            millisecond = (int)(millisecondsSinceEpoch - (fullSecondsSinceEpoch * 1000L));

        ticks:
        for (;; year++) {
            for (month = 1; month <= 12; month++) {
                for (dayOfMonth = 1; dayOfMonth <= daysInMonth(month, year); dayOfMonth++) {
                    for (hour = 0; hour < 24; hour++) {
                        for (minute = 0; minute < 60; minute++) {
                            for (second = 0; second < secondsInMinute(minute, hour, dayOfMonth, month, year); second++, fullSecondsSinceEpoch--) {
                                if (fullSecondsSinceEpoch == 0) {
                                    break ticks;
                                }
                            }
                        }
                    }
                }
            }
        }
        return String.format("%04d-%02d-%02d %02d:%02d:%02d.%03d", year, month,
            dayOfMonth, hour, minute, second, millisecond);
    }

    /**
     * Returns the seconds in the given minute of the given hour/day/month/year,
     * taking into account leap seconds that can be added to the last minute of
     * June or December.
     */
    private static int secondsInMinute(int minute, int hour, int day, int month, int year) {
        return (minute == 59 && hour == 23 && ((day == 30 && month == 6) || (day == 31 && month == 12)))
                ? 60 + leapSecondsInMonth( month, year)
                : 60;
    }

    /**
     * Returns the number of days in the given month of the given year.
     */
    private static int daysInMonth(int month, int year) {
        return month == 2 ? isLeapYear(year) ? 29 : 28
                : MONTHS_WITH_30_DAYS.contains(month) ? 30
                    : 31;
    }

    /**
     * Returns whether the given year is a leap year or not.
     * A leap year is every 4th year, but not if the year is divisible by 100, unless if it's divisible by 400.
     */
    private static boolean isLeapYear(int year) {
        return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) ? true : false;
    }

    /**
     * Returns the number of leap seconds that were added to UTC time at the end of the given month and year.
     * Leap seconds are added (by the decison of International Earth Rotation Service / Paris Observatory)
     * in order to keep UTC within 0.9 seconds of international atomic time (TAI).
     * <p>TODO: implement parser for updated list at http://www.ietf.org/timezones/data/leap-seconds.list :)
     */
    private static int leapSecondsInMonth(int month, int year) {
        return (year < 1972 || year > 2012) ? 0
                : (month == 6 && YEARS_WITH_LEAP_SECOND_IN_JUNE.contains(year)) ? 1
                    : (month == 12 && YEARS_WITH_LEAP_SECOND_IN_DECEMBER.contains(year)) ? 1
                        : 0;
    }

    public final static void main(String[] args) throws Exception {
        System.out.println(new FixedTimeAPI4Java().getTime());
    }
}

HTML
Pure HTML, no Javascript or anything. Less is more.
<title>Time</title>
<iframe src="http://wwp.greenwichmeantime.com/time/scripts/clock-8/runner.php"></iframe>

jsFiddle

Python in a linux xterm
import os
n=os.stat('/dev/ptmx')[7]
n,s=divmod(n,60)
n,m=divmod(n,60)
n,h=divmod(n,24)
y,d=divmod(n,365)
print "It is {}:{}:{} GMT on the {}th day of {}".format(
    h,m,s,d-(y/4-1),y+1970)

/dev/ptmx/ has its timestamp updated every time the xterm is written to, which includes the command invocation.

Groovy
def latLong = "http://www.ipligence.com/geolocation".toURL().text =~ /GLatLng\(([^)]*)/
def lat= latLong[0][1].tokenize(",")[0].trim()
def lng = latLong[0][1].tokenize(",")[1].trim()
def xml = "http://www.earthtools.org/timezone/${lat}/${lng}".toURL().text
println new XmlSlurper().parseText(xml).localtime

Get latitude and longitude by IP address, then make a Http request to a time server via the latitude and longitude.

CPython
gettime.py:
import struct
import gettime

if __name__ == '__main__':
    print struct.unpack('i', open('gettime.pyc').read()[4:8])[0], 'seconds after Unix epoch'

The self-import statement compiles it to a .pyc file, which contains the timestamp as the second 4-byte word.
Doesn't work multiple times in a row unless you change the .py file or delete the .pyc file.

Wolfram Language
WolframAlpha["now", {{"Result", 1}, "Plaintext"}]

> 11:15:35 pm MSK  |  Monday, March 10, 2014

Isn't "now" a built in function for time?

@Milo No, it's online query to wolframalpha.com.

authors: Сергей Костин


text:
Pokeball Simulator
In the Pokemon video games, the player is sent out into the world to force wild animals into tiny balls and train them to fight. Of course, everyone knows that no one plays Pokemon for the battling. The real draw the series has is the pokemon catching itself! Your job is to simulate the pokeball during a capture attempt. This challenge will use the generation V capture formula, which is as follows:

HP_max is equal to the target pokemon's maximum HP. HP_current is equal to the target pokemon's current HP. rate is the catch rate of the pokemon, bonus_ball is the thrown pokeball's multiplier, and bonus_status is 2.5 if the target pokemon is asleep or frozen, 1.5 if the target pokemon is paralyzed, poisoned, or burned, and 1 otherwise.
After finding a, you are to perform up to three "shake checks". The probability of a shake check succeeding is 65536 / (255 / a)^(1/4). If any one of these checks fails, the pokemon escapes its ball. If all three checks are successful, the pokemon is caught!
Note: Whenever any division is performed, the result is rounded down to a multiple of 1/4096. This is generally an insignificant detail, but it must be accounted for in your program.
Your challenge is to write a program that executes the shake checks and prints to stdout the status of the checks. On stdin, your program will receive (at least, details below) the maximum HP of the pokemon, the catch rate of the target pokemon, and the name of the pokeball. The maximum HP and the catch rate are both guaranteed to be integers, while the name of the pokeball is always a string. This input may come in any order and with any delimiting character(s) is convenient for you, so long as it's consistent. Assume that the input is correct, no error handling is required.
The names of the pokeballs you are required to support and their catch multipliers are listed here:
  Poke | 1
 Great | 1.5
 Ultra | 2
Master | 255

You may assume that the target is asleep and at 1 HP. The expected format for output is this:
(First check failed)
(no output)

(Second check failed)
*shake*

(Third check failed)
*shake*
*shake*
*shake*

(All checks pass)
*shake*
*shake*
*shake*
Click!

(That isn't a typo, your program should never output just two shakes.)
This is code-golf, so your score is your program's source code's byte count. Lowest score wins.
Bonuses!
I said that you may assume the pokemon is at 1 HP and asleep. Alternatively, you may allow the user to input the pokemon's current HP and bonus_status. The pokemon's current HP will always be an integer equal to or less than its maximum HP, and bonus_status will always be either 2.5, 1.5 or 1. If you do, you must have these values at the end of your input, and default to 1 and 2.5 if they're not supplied. You may subtract 15 points from your score for implementing one of these, or 25 for both.
Additionally, you may implement critical captures. If a critical capture occurs, only one shake test is performed. If failed, the program exits silently. If passed, it outputs:
*shake*
Click!

Critical captures become more common as the player collects more pokemon, but for simplicity's sake we can assume that they have already "caught 'em all". If a randomly generated number between 0 and 2047 is less than a (the result of the first calculation) multiplied by 2.5, that's a critical capture. Support for critical captures allows you to remove 25 points from your score.
There are a number of other pokeballs you may choose to support. Their names and catch multipliers are listed here:
Safari | 1.5
 Sport | 1.5
  Lure | 3
   Net | 3
  Dusk | 3.5
  Dive | 3.5
  Moon | 4
  Fast | 4
 Quick | 5
  Love | 8

For each of these balls you add support for, you may subtract (5 + the length of the ball's name) from your score.
Finally, for kicks, achieving all of these bonuses (current HP and bonus_status from stdin, critical captures, and all 10 optional balls) will net you an additional reward of 7 points removed from your score, for an even 150 total bonus.
Example Input/Output
Just to ensure we're all on the same page.
$ ./balls <<< "19,Ultra,255"
*shake*
*shake*
*shake*
Click!

Good luck, and happy golfing!

I currently can't judge how big the probability you give as 65536 / (255 / a)^(1/4) can get but my guts says it is greater than 1. Do you check against a random number in the range of 0 to 65536? Does the check succeed if the random number is bigger or if it is lower?

If 65536 / (255 / a)^(1/4) is greater than 1, the check automatically succeed. I'm not sure what you mean by the second question.

So rnd < p means the check is successfull with rnd in range of 0 and 1.

Yes, that's correct.

There is something I'm not getting: how is the 'shake test' made? (I play pokemon, sometimes, and i know pretty damn well what it is, I just don't understand how the 'shake test' is performed).

@IsmaelMiguel see my comments: you generate a random number in the range of 0 to 1 and compare it against 65536 / (255 / a)^(1/4), then if the random number is less the shake test succeeded

@TheConstructor to obtain a, we need a list of all the pokemons, so that we know each one's HPmax.

As state in the text the textual type of pokeball, max hp and catch rate are past as input to your program. Optionally you can ask for current hp (default 1) or status bonus (default 2.5)

@undergroundmonorail for Poke, catch-rate=1, max-hp=255 I get p=20609.248046875. Are you shure the random number is in the range of 0 to 1? 0 to 65536 (or greater) sounds more resonable to me.

Wiki also says random between 0 and 65535 (inclusive)

And to think, Pokemon was just a simple game that involved very little math...

J 301-150 = 151
For sports, all bonuses implemented, though I'd probably be better off not to :).
I shortly explained things below, but this one is far too long to explain in detail, unless someone explicitly requests.
It implements all balls, critical captures, and optional inputs.
tm =: =*./@:+.' '=] NB. Template match, match non-blanks in right with left
balls  =: 'MMLLPGSUNDFQ',.12{.'oauo' NB. space = wildcard.
NB. lookup function: name -> bonus_ball
lookup =: 4 255 3 8 1 1.5 1.5 2 3 3.5 4 5 #~ (tm"1&balls)@(2&{.)

NB. convert given option
options =: ;".`lookup@.(_=_&".);._2 ,&',' i3 NB. parse options to numeric values
NB. add defaults if necessary
complete =: (, 1 2.5{.~(5-$)) options
NB. formula
r=: <.&.(*&4096)                              NB. round to 1/4096
NB. a=: ((3*zeroth - 2*thirth)*first*second*fourth)/(3*zeroth)
a=:r(1-3%~2*%/3 0{complete)**/1 2 4{complete  NB. A prime, already divided by 255

NB. Critical captures
crit =: >2r5*[:?11^~2: NB. check for critical, k a
mess =: 2 7$'*shake*Click! '"_ NB. Message template
check =: >"0 [:?(4$2^16)"_     NB. Perform 4 checks
mes2 =: mess#~3(<.,<)]          NB. Construct message from number of passed checks
NB. If critical, just output the message array, else do the 4 tests, and execute mes2 on their running and (meaning count the number of uninterrupted trues)
echo mes2@(+/)@(*./\)@(check"0)@(65536%4%:[:r 255%])`mess@.crit a

Here the golfed version
NB. Golfed verion
echo(m#~3(<.,<)])@(+/)@(*./\)@(>"0[:?(4$2^16)"_)@(65536%4%:[:r 255%])`(m=:2 7$'*shake*Click! '"_)@.(>2r5*[:?11^~2:)(r=:<.&.(*&4096))(1-3%~2*%/3 0{co)**/1 2 4{co=:(,1 2.5{.~(5-$));(".`(4 255 3 8 1 1.5 1.5 2 3 3.5 4 5 #~((=*./@:+.' '=])"1)&('MMLLPGSUNDFQ',.12{.'oauo')@(2&{.)))@.(_=_&".);._2,&','stdin''

Perl 1 (374 - 150 = 224 + MissingNo. bytes)
sub h{print "*shake*
";}($x,$h,$_,$c,$s)=split(/,/,<>);$G=$$%(/P/?256:/U/?151:201);$S=$G-($s==1?0:$s==1.5?12:25);
$F=255&int(int($h*255/(/G|S/?8:12))/(int($x/4)||1));sub c{for($i=0;$i<3;$i++){do h();}print "Click!
";exit;}
/M/||$S<0||$S<$c&&$F>$$*$$%255&&do c();$W=int(int($c*100/(/P/?255:/U/?150:200))*$F/255)+($s==1?0:$s==1.5?5:10);$W>9&&do h();$W>29&&do h();$W>69&&do h();

Argument list:
current hp, max hp, pokéball, catch rate, status, critical capture

Yes, I'm aware this completely breaks the rules, but I don't care. In case you haven't noticed, this is first Pokémon generation capture algorithm, with all its quirks (Great Balls are better than Ultra Balls, in certain conditions). This implements all features, including ones that aren't included (and I decided to include points for them anyway). Critical captures are ignored (but they are implemented - just that they don't affect the capture rate), newer Poké Balls load data of other Poké Balls.
Please note that while this answer is short, it breaks all the rules, so consider it just to be a fun answer, don't accept it. I was initially going to implement Gen5 algorithm in Perl 5, but I decided - why not have some fun. And yes, I actually compiled Perl 1, and this code works. If you run it in newer version of Perl, you may get warnings about deprecated use of do, but let's be honest - it's the only way to run functions in Perl 1. Perl 1 also has some quirks on its own (for example, I cannot move the line starting with /M/ to previous line - why? - I don't know).
Also, there are no random numbers in Perl 1, so hope you won't kill me for modulo of $$. It's the closest thing to the random number I could have found.
Edit: It appears that the old do call() syntax was removed in Perl 5.19.8. Make sure you use an older version of Perl to run this script, as it appears that Perl 5.20 won't be compatible with Perl 1 scripts.

PYTHON 249 bytes - 75 for bonuses = 174
My first try ever golfing.
import sys,random
y=sys.argv
d,b,f={10:1,1:1.5,15:2,7:1.5,13:255,-2:3.5,6:3,8:3,0:4,11:5},3*int(y[1]),"*shake*\n"
s=lambda:random.random()*(255*b)**.25<65536*((b-2)*int(y[3])*d[ord(y[2][0])-70]*2.5)**.25
if s():print f*3+"Click!" if s()and s()else f

Bonus for including selected balls: Safari, Sport, Lure, Net, Dusk,
Dive, Fast, Quick
Giving me 8*5+6+5+4+3+4+4+4+5=75 bonus points
[edit]  Round down to 12 fractional bits every time division is used by not using it
[edit2] optimize pokeball dictionary

I think you are using a precission higher than 1/4096 (question states Note: Whenever any division is performed, the result is rounded down to a multiple of 1/4096.)

You are probably right, I didn't quite understand that part and the other answers seemed to do it same way I did.
I guess I need to do something like this:
r < 65536/(255/a)^(0.25) <=> r*255^(0.25)/a^(0.25) < 65536 <=> r*255^(0.25) < 65536*a^(0.25) to exclude all divisions?

1/4096 mean 12 fractional bits. Have a look at my solution; a more direct approach would be floor(x*4096)*4096 just as you would round down to e.g. decimal places.

Ohh I see, thank you. This should likely also apply to multiplication like you seem to have done it, but since that is not stated in the rules I´m not going to worry about that. :)

Yes, probably they use fixed-point arithmetics. But OP only asked to round division.

PHP (746 763 bytes - all bonuses):
<?if(!$i=fgets(STDIN))die('');parse_str($i,$i);$b=array('poke'=>1,'great'=>1.5,'ultra'=>2,'master'=>255,'safari'=>1.5,'sport'=>1.5,'lure'=>3,'net'=>3,'dusk'=>3.5,'dive'=>3.5,'moon'=>4,'fast'=>4,'quick'=>5,'love'=>8);$s=array('sleep'=>2.5,'frozen'=>2.5,'paralyzed'=>1.5,'poisoned'=>1.5,'burnt'=>1.5,''=>1);$i=array_merge(array('ball'=>'poke','hp'=>array('max'=>25,'current'=>1),'status'=>2.5,'rate'=>255),$i);$l='strtolower';$r='mt_rand';$x='*shake*'.PHP_EOL;$c='Click!'.PHP_EOL;$a=(((3*$i[hp][max])-(2*$i[hp][current]))*$i[rate]*$b[$l($i[ball])])/(3*$i[hp][max])*(is_numeric($i[status])?$i[status]:$s[$l($i[status])]);$a=((pow(65536/(255/$a),0.25)*4096)<<0)/4096;if($r(0,1)>$a)die();echo$x;if($a>1)die($c);if($r(0,1)>$a)die();echo$x,$x;if($r(0,1)>$a)die();echo$c;

To use this, you have to provide the input as 'ball=poke&status=sleep' on STDIN.
The HP must be provided as 'hp[max]' or 'hp[current]'.
This code works, as tested here.
You can provide the status by it's name or the multiplier. (not required in the question).
Here is a readable version:
if(!$info=fgets(STDIN))die('');
parse_str($info,$info);
$balls=array(//list of pokeballs
    'poke'=>1,
    'great'=>1.5,
    'ultra'=>2,
    'master'=>255,
    'safari'=>1.5,
    'sport'=>1.5,
    'lure'=>3,
    'net'=>3,
    'dusk'=>3.5,
    'dive'=>3.5,
    'moon'=>4,
    'fast'=>4,
    'quick'=>5,
    'love'=>8
);
$status=array(//list of status
    'sleep'=>2.5,
    'frozen'=>2.5,
    'paralyzed'=>1.5,
    'poisoned'=>1.5,
    'burnt'=>1.5,
    ''=>1 //in case there is no status
);
$info=array_merge(//this will set the default values
    array(
        'ball'=>'poke',
        'hp'=>array('max'=>25,'current'=>1),
        'status'=>2.5,
        'rate'=>255
    ),
    $info
);
$a=(((3*$info['hp']['max'])-(2*$info['hp']['current']))*$info['rate']*$balls[strtolower($info['ball'])])/(3*$info['hp']['max'])*(is_numeric($info['status'])?$info['status']:$status[strtolower($info['status'])]);
$a=((pow(65536/(255/$a),0.25)*4096)<<0)/4096;//same as $a=floor(pow(65536/(255/$a),0.25)*4096)/4096;

if(mt_rand(0,1)>$a) die();//test 1
echo '*shake*',PHP_EOL;
if($a>1)die('Click!'.PHP_EOL);//if $a>1, catch it (critical catch)

if(mt_rand(0,1)>$a) die();//test 2
echo'*shake*',PHP_EOL,'*shake*',PHP_EOL;

if(mt_rand(0,1)>$a) die();//test 3
echo 'Click!',PHP_EOL;//passed all tests

I had to edit this because i was using a much higher precision than the required.
The fix was provided by TheConstructor.

I think you are using a precission higher than 1/4096 (question states Note: Whenever any division is performed, the result is rounded down to a multiple of 1/4096.)

And you are right. I noticed that I'm using whatever value comes from the division. If you want, you can give me some help 'cause i have no damn idea of how to 'round' to a smaller precision in PHP.

You can do floor(x*4096)/4096 or implement fixed-point division like I did.

Thank you for your help. I would never think of that. I have fixed my answer.

Java, 611
import java.util.*;class P{enum B{DI(35),DU(35),FA(40),GR(15),LO(80),LU(30),MA(2550),MO(40),NE(30),PO(10),QU(50),SA(15),SP(15),UL(20);long v;B(int i){v=((long)i<<12)/(long)10;}}public static void main(String[]y){Scanner s=new Scanner(System.in);B b=B.valueOf(s.next().toUpperCase().substring(0,2));long c=(long)(s.nextDouble()*4096);long m=s.nextLong()<<12;long h=(s.hasNextInt()?s.nextLong():1)<<12;long S=(long)((s.hasNextDouble()?s.nextDouble():2.5)*4096);long p=(65536L<<12)/(long)(Math.sqrt(Math.sqrt((255L<<24)/((((3L*m-2L*h)*c>>12)*b.v>>12<<12)/(3L*m)*S>>12)))*512);Random r=new Random();System.out.print(r.nextInt(65536)<p?"*shake*\n"+(r.nextInt(65536)<p?"*shake*\n*shake*\n"+(r.nextInt(65536)<p?"Click!\n":""):""):"");}}

Score:

729 Bytes
-93 all Balls
-25 optional current_hp and bonus_state

=> 611
The program uses fixed-point-arithmetics with 12 fraction-bits (1/4096 is the value of the right most bit). As Java does not usually use fixed-point there are quite some shifts inside the code to achieve the expected results. See long version for the used arithmetic functions, which have been inlined for golfing purposes.
While most calculations could have been done on int values, divisions work better with longs as you need to shift the dividend by another 12 bit to the left to keep the desired precision (otherwise you loose all fraction-bits).
Sample input ( ; is only required if run interactively i.e. STDIN has not received EOF): Ball, catch_rate, max_hp

Poke 15 255 ;

Sample output:

*shake*

Sample input: Ball, catch_rate, max_hp, current_hp, bonus_state

Moon 42 255 50 1.5

Sample output:

*shake*
*shake*
*shake*
Click!

import java.math.BigDecimal;
import java.util.Random;
import java.util.Scanner;

class Pokeball {
    static long shift(long i) {
        return i << 12;
    }
    enum B {
        DI(35),DU(35),FA(40),GR(15),LO(80),LU(30),MA(2550),MO(40),NE(30),PO(10),QU(50),SA(15),SP(15),UL(20);
        long v;
        B(int i) {
            v = semiFixedDivision(shift(i),10);
        }
    }

    public static void main(String[] args) {
        final Scanner s = new Scanner(System.in);
        B b = B.valueOf(s.next().toUpperCase().substring(0, 2));
        long catchRate = (long) (s.nextDouble() * 4096);
        long maxHp = shift(s.nextLong());
        long currentHp = shift(s.hasNextInt()?s.nextInt():1);
        long statusBonus = (long) ((s.hasNextDouble()?s.nextDouble():2.5) * 4096);
        long a = fixedMultiplication(fixedDivision(fixedMultiplication(fixedMultiplication(
                semiFixedMultiplication(3, maxHp) - semiFixedMultiplication(2, currentHp), catchRate), b.v),
                                                   semiFixedMultiplication(3, maxHp)), statusBonus);
        println("a=",a);
        long x = fixedFourthRoot(fixedDivision(shift(255), a));
        println("x=",x);
        println("x^4=",fixedMultiplication(fixedMultiplication(x,x), fixedMultiplication(x,x)));
        long p = semiFixedDivision(shift(65536), fixedFourthRoot(fixedDivision(shift(255), a)));
        Random r = new Random();
        System.out.print(r.nextInt(65536) < p ?
                         "*shake*\n" + (r.nextInt(65536) < p ?
                                        "*shake*\n*shake*\n" + (r.nextInt(65536) < p ?
                                                                "Click!\n" :
                                                                "") :
                                        "") :
                         "");
    }

    private static long unshift(long p) {
        return p >> 12;
    }

    private static void println(String s, long v) {
        System.out.print(s);
        println(v);
    }

    private static void println(long v) {
        System.out.printf("%s%n", BigDecimal.valueOf(v).divide(BigDecimal.valueOf(4096)));
    }

    /**
     * Calculates division of {@code a/b} with both number last 12 bits treated as being "right of the dot"
     */
    static long fixedDivision(long a, long b) {
        return (a<<12)/b;
    }

    /**
     * Calculates division of {@code a/b} with {@code a}'s last 12 bits treated as being "right of the dot"
     */
    static long semiFixedDivision(long a, long b) {
        return a/b;
    }
    static long fixedMultiplication(long a, long b) {
        return (a*b) >> 12;
    }
    static long semiFixedMultiplication(long a, long b) {
        return a*b;
    }
    static long fixedFourthRoot(long a) {
        return (long)(Math.sqrt(Math.sqrt(a)) * 512);
    }
}

CoffeeScript - 317 313 310 307 306 294 270 250 242 bytes
342 - 25 (parameters) - 75 (12 balls) = 242
_=process.stdin
l=console.log
m=Math
s=m.sqrt
t=['*shake*','Click!']
n=65536
_.resume()
_.setEncoding 'utf8'
_.on 'data',(d)=>
 [A,B,C,E,F]=d.match /\w+/g;E||=1;F||=2.5;i=0;while i++<3
  if n*(s s (3*A-2*E)*B*{P:1,G:1.5,U:2,M:255,S:1.5,L:3,N:3,D:3.5,F:4,Q:5}[C.charAt 0]*F)<m.floor(m.random()*n)*s s 765*A
   break
  l t[0]
 if i>2
  l t[i-3]

Expects input HP_max,Rate,Ball[,HP_current[,status]]. Does not support Moon or Love balls.
This is the first thing I ever golfed that's not a regex, so there is probably room for improvement. I've shamelessly copied the idea to store only partial ball names. ;) Supporting the other two balls is simply not worth it, not even with the additional +7 for getting all bonuses.
Ungolfed version
This version omits all the short aliases I define at the beginning, but does define the ball-lookup separately.
balls =
  P: 1
  G: 1.5
  U: 2
  M: 255
  S: 1.5
  L: 3
  N: 3
  D: 3.5
  F: 4
  Q: 5

messages = ['*shake*', 'Click!']

process.stdin.resume()
process.stdin.setEncoding 'utf8'
process.stdin.on 'data', (data) =>
  [HP_max, rate, ball, HP_current, status] = data.match /\w+/g
  HP_current ||= 1
  HP_status ||= 2.5
  i = 0
  while i++ < 3
    if 65536 * (Math.sqrt Math.sqrt (3*HP_max - 2*HP_current)*rate*status*balls[ball.charAt 0]) < Math.floor(Math.random()*65536) * Math.sqrt Math.sqrt 765*HP_max
      break
    console.log messages[0]
  if i > 2
    console.log messages[i-3]

A note on the probability formula: I've rearranged the full formula (with written out a) so that there are no divisions, and I'm computing (...)^(1/4) by taking the square root twice.

Looks like precendence is on your side O.o p-=p%1/4096 really seems to work. (Would have guessed you would at least need to write p-=p%(1/4096) and then still I would not be sure modulus is implemented for fractions on both side. Nice!

@TheConstructor Haha, yeah I actually had to check that... it looked really weird to me too, but % can be used for some funny things in JS. After re-reading the question, I think this answer doesn't quite fulfil the rounding requirement though. I think rounding should be applied after each division. I might have to restructure my calculation a bit. ^^

Yes probably still good idea

@TheConstructor Actually, I do need to write p%(1/4096). I even checked this before posting, but somehow remembered the result of my test wrong.

Tried in Chrome; worked without () but maybe not always or not on all browsers...

@TheConstructor I tried in Chrome too and (0.1-0.1%1/4096)*4096 doesn't give me an integer.

let us continue this discussion in chat

Update: (C#)
Byte count: 3,600
Critcal: -25
All poke-balls: -91

Total = 3,484
[golfed]
using System;using System.Text;using System.Security.Cryptography;using System.Linq;namespace Pokemon{public class MainClass{private string[] c(string[] i){if(i.Length <= 3){var v1 =i[0][0];var v2 =i[1][0];var v3 =i[2][0];if(v1>='0'&&v1<='9'&&v2>='a'&&v2<='z'&&v3>='0'&&v3<='9')return new string[]{i[0],i[2],i[1]};else if(v1>='0'&&v1<='9'&&v2>='0'&&v2<='9'&&v3>='a'&&v3<='z')return new string[]{i[0],i[1],i[2]};else if(v1>='a'&&v1<='z'&&v2>='0'&&v2<='9'&&v3>='0'&&v3<='9')return new string[]{i[1],i[2],i[0]};else return null;}else return null;}private static void Main(string[] args){while(true){Console.Clear();MainClass _c = new MainClass();Console.Write("Inputs'please:");var i = Console.ReadLine().ToLower();string[] r = _c.c((string[])(i.Split(new Char[]{' ','.',',','\n','\t','!','@','#','$','%','^','&','&','*','(',')','-','_','+','=','?','/','\\'},StringSplitOptions.RemoveEmptyEntries).Select(p=>p.Trim()).ToList()).ToArray());new w("Processing...\n");if(r== null)new w("Too many errors");else new m(r);}}}public class w{public w(string l){Console.WriteLine(l);}}public class m{public m(string[] v){switch (v[2].Substring(0,2)){case "po":c(v[0],v[1],"1");break;case "ul":c(v[0],v[1],"2");break;case "ma":c(v[0],v[1],"255");break;case "gr":case "sa":case "sp":c(v[0],v[1],"1.5");break;case "lu":case "ne":c(v[0],v[1],"3");break;case "du":case "di":c(v[0],v[1],"3.5");break;case "mo":case "fa":c(v[0],v[1],"4");break;case "qu":c(v[0],v[1],"5");break;case "lo":c(v[0],v[1],"8");break;default:new w("Not supported");break;}}private double y(double v){return Convert.ToDouble(((double)1/(double)4096)*(v/Convert.ToDouble(1/4096)-(v%Convert.ToDouble(1/4096))));}private bool i(double v,double r,double b){if(((double)new Random().Next(0,(int)r))>b*v)return true;else return false;}private double f(double r, double h, double b){return 2.5*y((((3.0*h)-2.0)*r*b)/(3.0*h));}private void c(params string[] v){var s =0.0;var x =0;if(int.Parse(v[1])>100&&int.Parse(v[1])<= 255){s =f(double.Parse(v[0]),double.Parse(v[1]),double.Parse(v[2]));x=0;}else if(int.Parse(v[0])>100&&int.Parse(v[0])<= 255){s =f(double.Parse(v[1]),double.Parse(v[0]),double.Parse(v[2]));x=1;}else{new w(String.Format("Which number is the Max HP? :{0} or {1}:",v[0],v[1]));var c_ = int.Parse(Console.ReadLine());s =f((double.Parse(v[0])+double.Parse(v[1]))-double.Parse(v[c_]),double.Parse(v[c_]),double.Parse(v[2]));x=2;}if(((double)new Random().Next(0, 2047))<s*2.5)new w("*shake*\nClick!");else{for(int c_= 0;c_<3;c_++){new w("*shake*");var r =Math.Pow(65536.0/y(255.0/s),0.25);if(i(r,double.Parse(v[x]),2.5)==true){new w("Click!");break;}else;}}Console.ReadKey();}}}

[regular]
using System;
using System.Text;
using System.Security.Cryptography;
using System.Linq;

namespace Pokemon
{
    public class MainClass
    {
        private string[] c(string[] i)
        {
            if (i.Length <= 3)
            {
                var v1 =i[0][0];
                var v2 =i[1][0];
                var v3 =i[2][0];
                if(v1>='0'&&v1<='9'&&v2>='a'&&v2<='z'&&v3>='0'&&v3<='9')return new string[]{i[0],i[2],i[1]};
                else if(v1>='0'&&v1<='9'&&v2>='0'&&v2<='9'&&v3>='a'&&v3<='z')return new string[]{i[0],i[1],i[2]};
                else if(v1>='a'&&v1<='z'&&v2>='0'&&v2<='9'&&v3>='0'&&v3<='9')return new string[]{i[1],i[2],i[0]};
                else return null;
            }
            else return null;
        }

        private static void Main(string[] args)
        {
            while(true)
            {
                Console.Clear();
                MainClass _c = new MainClass();
                Console.Write("Inputs'please:");
                var i = Console.ReadLine().ToLower();
                string[] r = _c.c((string[])(i.Split(new Char[]{' ','.',',','\n','\t','!','@','#','$','%','^','&','&','*','(',')','-','_','+','=','?','/','\\'},StringSplitOptions.RemoveEmptyEntries).Select(p=>p.Trim()).ToList()).ToArray());
                new w("Processing...\n");
                if(r== null)new w("Too many errors");
                else new m(r);
            }
        }
    }

    public class w
    {
        public w(string l)
        {
            Console.WriteLine(l);
        }
    }

    public class m
    {
        public m(string[] v)
        {
            switch (v[2].Substring(0,2))
            {
                case "po":
                    c(v[0],v[1],"1");
                    break;
                case "ul":
                    c(v[0],v[1],"2");
                    break;
                case "ma":
                    c(v[0],v[1],"255");
                    break;
                case "gr":
                case "sa":
                case "sp":
                    c(v[0],v[1],"1.5");
                    break;
                case "lu":
                case "ne":
                    c(v[0],v[1],"3");
                    break;
                case "du":
                case "di":
                    c(v[0],v[1],"3.5");
                    break;
                case "mo":
                case "fa":
                    c(v[0],v[1],"4");
                    break;
                case "qu":
                    c(v[0],v[1],"5");
                    break;
                case "lo":
                    c(v[0],v[1],"8");
                    break;
                default:
                    new w("Not supported");
                    break;
            }
        }

        private double y(double v){return Convert.ToDouble(((double)1/(double)4096)*(v/Convert.ToDouble(1/4096)-(v%Convert.ToDouble(1/4096))));}

        private bool i(double v,double r,double b){if(((double)new Random().Next(0,(int)r))>b*v)return true;else return false;}

        private double f(double r, double h, double b){return 2.5*y((((3.0*h)-2.0)*r*b)/(3.0*h));}

        private void c(params string[] v)
        {
            var s =0.0;
            var x =0;
            if(int.Parse(v[1])>100&&int.Parse(v[1])<= 255){s =f(double.Parse(v[0]),double.Parse(v[1]),double.Parse(v[2]));x=0;}
            else if(int.Parse(v[0])>100&&int.Parse(v[0])<= 255){s =f(double.Parse(v[1]),double.Parse(v[0]),double.Parse(v[2]));x=1;}
            else
            {
                new w(String.Format("Which number is the Max HP? :{0} or {1}:",v[0],v[1]));
                var c_ = int.Parse(Console.ReadLine());
                s =f((double.Parse(v[0])+double.Parse(v[1]))-double.Parse(v[c_]),double.Parse(v[c_]),double.Parse(v[2]));
                x=2;
            }
            if (((double)new Random().Next(0, 2047))<s*2.5)new w("*shake*\nClick!");
            else
            {
                for(int c_= 0;c_<3;c_++)
                {
                    new w("*shake*");
                    var r =Math.Pow(65536.0/y(255.0/s),0.25);
                    if (i(r,double.Parse(v[x]),2.5)==true){new w("Click!");break;}else;
                }
            }
            Console.ReadKey();
        }
      }
  }

This is code golfing. You should reduce your answer (eg: stripping whitespaces). You still can provide the current answer as a readable version.