This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compiled with -O3 | |
// cat C-large-practice.in 0.00s user 0.00s system 81% cpu 0.003 total | |
// ./a.out 4.18s user 0.13s system 99% cpu 4.318 total | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define NOT_FOUND 0xFFFFFFFF | |
#define MAX_PRISONERS 10000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: latin-1 -*- | |
# Euler published the remarkable quadratic formula: | |
# | |
# n² + n + 41 | |
# | |
# It turns out that the formula will produce 40 primes for the consecutive values n = 0 to 39. However, when n = 40, 402 + 40 + 41 = 40(40 + 1) + 41 is divisible by 41, and certainly when n = 41, 41² + 41 + 41 is clearly divisible by 41. | |
# | |
# Using computers, the incredible formula n² − 79n + 1601 was discovered, which produces 80 primes for the consecutive values n = 0 to 79. The product of the coefficients, −79 and 1601, is −126479. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import factorial | |
digits = "0123456789" | |
target = 1000000 | |
def lex(perm, values): | |
vlen = len(values) | |
for i in xrange(vlen): | |
num_perms = factorial(vlen - i) | |
if perm >= num_perms: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
day = 1 | |
year = 1900 | |
mons = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] | |
fom_sundays = 0 | |
def is_leap_year(year): | |
return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) | |
while year < 2001: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install this recipe with: | |
# brew install --HEAD https://raw.github.com/gist/1955470/c58bda92f07147afff64a86d0c2d8ef65adb9cd6/elixir.rb | |
require 'formula' | |
class Elixir < Formula | |
homepage 'http://elixir-lang.org/' | |
head 'https://github.com/elixir-lang/elixir.git' | |
depends_on 'erlang' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- file_templates.vba 2011-02-24 22:53:45.000000000 -0800 | |
+++ file_templates_updated.vba 2011-02-24 22:54:15.000000000 -0800 | |
@@ -165,6 +165,7 @@ | |
\ '$LBASENAME$': tolower(expand('%:t:r')), | |
\ '$YEAR$': strftime("%Y"), | |
\ '$DATE$': strftime('%d/%m/%Y'), | |
+ \ '$FULLDATE$': strftime('%d %b %Y'), | |
\ } | |
let [lnum, cnum] = searchpos(s:VarTagMatch) |
NewerOlder