Skip to content

Instantly share code, notes, and snippets.

# spoj
# boo freakin hoo spoj
@gorlum0
gorlum0 / Test.py
Created December 13, 2010 01:24
spoj.pl/problems/TEST
__author__ = 'gorlum0'
for line in iter(raw_input, '42'):
print line
# spoj.pl/problems/TEST
# author: gorlum0
print while gets.chop != "42"
@gorlum0
gorlum0 / gist:1138131
Created August 10, 2011 20:24
my stylebot - 2011-08-11
{"lighthouseapp.com":{"_rules":{"div.file div.input *,\r\n\tdiv.file div.name *,\r\n\tdiv.meta div.info *,\r\n\tdiv.meta div.actions *,\r\n\t.url-field, div#browser *,\r\n\t.blob-editor textarea,\t\t\t\r\n\t.data pre,\t\t\t\t\r\n\t.line-data,\t\t\t\t\r\n\t.line-number,\t\t\t\t\r\n\t.machine,\r\n\t.machine *,\r\n\ttextarea#style_long_description,\t\r\n\ttextarea#css,\t\t\t\t\r\n\ttt,\r\n\tpre,\r\n\tpre *,\r\n\tkbd, \r\n\tcode,\r\n\t.group-cnt textarea,\t\t\t\r\n\t#ticket-form textarea":{"font-family":"\"Consolas\",\r\n\t\t\t\t\"DejaVu Sans Mono\",\r\n\t\t\t\t\"Monaco\",\r\n\t\t\t\t\"Andale Mono\",\r\n\t\t\t\t\"Courier New\",\r\n\t\t\t\tmonospace !important"},"#commit .machine":{"width":"26em!important"},"#commit .human":{"width":"44em!important"},"#commit .message,\r\n\t#commit .message pre a":{"width":"100%!important"},".blob-editor textarea":{"width":"918px!important"},"textarea#style_long_description,\r\n\ttextarea#css":{"font-size":"12px!important","color":"#333!important"}},"_enabled":true},"userstyles.or
@gorlum0
gorlum0 / cf25-c.hs
Created August 12, 2011 19:31 — forked from u1ik/cf25-c.hs
codeforces - 25 - C (hs)
{-# LANGUAGE NewQualifiedOperators #-}
import Prelude
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import Data.List
import Control.Monad
import Control.Applicative
import Data.Maybe(fromJust)
@gorlum0
gorlum0 / Coins.py
Created August 12, 2011 23:27
spoj - Coins.py
#!/usr/bin/env python
"""(c) gorlum0 [at] gmail.com"""
from sys import stdin
def exchange(n, _cache = {0: 0}):
if not _cache.has_key(n):
v = exchange(n//2) + exchange(n//3) + exchange(n//4)
_cache[n] = max(n, v)
return _cache[n]
@gorlum0
gorlum0 / Coins.go
Created August 12, 2011 23:38
spoj - Coins.go
/*(c) gorlum0 [at] gmail.com*/
package main
import (
"fmt"
)
func max(x, y int64) int64 {
if x > y {
return x
@gorlum0
gorlum0 / Novice63.hs
Created August 12, 2011 23:39
spoj - Novice63.hs
{-# OPTIONS_GHC -O2 -XNoMonomorphismRestriction #-}
{-# LANGUAGE BangPatterns #-}
{-(c) gorlum0 [at] gmail.com-}
import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)
readNum = fst . fromJust . BS.readInteger
fI = fromIntegral
fact n = product [1..n]
@gorlum0
gorlum0 / A.hs
Created August 18, 2011 05:09
codeforces - 37 - A (hs)
{-# OPTIONS_GHC -O2 -XNoMonomorphismRestriction #-}
{-# LANGUAGE BangPatterns #-}
{-(c) gorlum0 [at] gmail.com-}
import Text.Printf
import Data.List (group, sort, maximumBy)
import Data.Ord (comparing)
towers bs = (h, t)
where
bs' = group . sort $ bs