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
| #include <stdio.h> | |
| #include <string.h> | |
| #include <stdlib.h> | |
| #define MAXN 5000000 | |
| int n; | |
| char c[MAXN], *a[MAXN]; | |
| int pstrcmp(const void **x, const void **y) { |
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
| import sys | |
| def bigmul(a, b): | |
| """r = a * b | |
| where | |
| r = bidmul(a, b)""" | |
| xs = list(reversed(digits(a))) | |
| ys = list(reversed(digits(b))) | |
| zs = [0 for i in xrange(300)] | |
| for i in xrange(len(ys)): |
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
| main :: IO () | |
| main = do | |
| x <- getLine | |
| y <- getLine | |
| print (read x + read y) |
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
| ultraDiv ∷ Integer → Integer → (Integer, Integer) | |
| -- pre: 1 <= d <= n | |
| -- post: a*d + b == n | |
| -- && (A) x > d . (a*x > n) | |
| -- where | |
| -- (a, b) = ultraDiv n d | |
| ultraDiv n d = bDiv n d 1 n | |
| where | |
| -- pre: same as ultraDiv | |
| -- && d * lower <= n && d * upper > n |
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
| -- PRE: xs is sorted and not null | |
| -- POST: r is xs without the elements that vary by | |
| -- more than err from the median | |
| gausselim ∷ (Num a, Ord a) ⇒ a → [a] → [a] | |
| gausselim err xs = filter good xs | |
| where | |
| middle = xs ‼ (length xs `div` 2) | |
| good x = abs (x - middle) < err |
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/python | |
| from __future__ import print_function | |
| import math, random | |
| acErr = 1e-5 | |
| def inCircle(x, y): | |
| """inCircle(x, y) iff (x, y) is in the circle of radius 1 centered at | |
| origin""" |
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
| module Main where | |
| import Data.Array.IArray | |
| import Data.Array.Unboxed | |
| import Data.Function | |
| import Data.List | |
| import Debug.Trace ( trace ) | |
| import System.IO.Unsafe ( unsafePerformIO ) | |
| import Text.Printf ( printf ) |
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
| module Warshall where | |
| import Data.Char ( isAlpha ) | |
| import Data.List ( nub, sort ) | |
| import System.Environment ( getArgs ) | |
| import Text.Parsec | |
| import Text.Parsec.String | |
| import Text.Printf ( printf ) | |
| type Vertex a = a |
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
| #!/bin/sh | |
| mencoder "$1" -o $1.mp4 -vf scale=480:320,harddup -of lavf -lavfopts format=ipod -alang en -sws 2 -oac faac -faacopts br=128:mpeg=4:object=2:raw -srate 44100 -ovc x264 -x264encopts bitrate=800:nocabac:level_idc=30:bframes=0:global_header:threads=2:subq=5:frameref=6:partitions=all:trellis=1:chroma_me:me=umh |
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
| #!/bin/bash | |
| ############# | |
| # FUNCTIONS | |
| ############# | |
| function h1 { | |
| echo | |
| echo "###################" | |
| echo "## $1" |
OlderNewer