This file contains 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 Control.Monad (forM_) | |
import Data.List.Split (splitOn) | |
import qualified Data.Map as M | |
import Data.Maybe (maybe) | |
import System.Environment (getArgs) | |
import System.IO (readFile) | |
parseLine :: String -> (String, Int) | |
parseLine str = let (key:count:_) = splitOn "\t" str | |
in (key, read count) |
This file contains 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
use strict; | |
use warnings; | |
use Time::Piece; | |
{ | |
no warnings 'redefine'; | |
my $orig_strptime = \&Time::Piece::strptime; | |
*Time::Piece::strptime = sub { | |
my @warns; | |
my $result = do { |
This file contains 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
dummy |
This file contains 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
use strict; | |
use warnings; | |
use Benchmark qw(cmpthese); | |
use Iterator::Simple qw(iter islice imap list); | |
my $n = 1000; | |
my $size = 10000; | |
my $start = $ARGV[0] // die; | |
my $end = $ARGV[1] // die; | |
my @list = (1 .. $size); |
This file contains 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
*~ |
This file contains 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
use strict; | |
use warnings; | |
use Test::More; | |
use sort '_quicksort'; | |
sub test_sort () { | |
my @sorted = sort { $a->[1] <=> $b->[1] } map { [$_, $_ % 2] } 1 .. 100; | |
is_deeply \@sorted, [(map { [$_ * 2, 0] } 1 .. 50), (map { [$_ * 2 - 1, 1] } 1 .. 50)]; | |
} |
This file contains 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 Control.Monad (forM_) | |
import qualified Data.Map as M | |
import qualified Distribution.PackDeps as PD | |
import GHC.Exts (sortWith) | |
main :: IO () | |
main = do | |
ns <- PD.loadNewest |
This file contains 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
use strict; | |
use warnings; | |
use Exporter qw(import); | |
our @EXPORT_OK = qw(solve); | |
my @fee_system = ( | |
[995, 400, 60], | |
[845, 350, 50], | |
); |
This file contains 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
package Answer; | |
use strict; | |
use warnings; | |
use Exporter qw(import); | |
our @EXPORT_OK = qw(solve); | |
sub directions ($$$$$) { | |
my ($n, $e, $s, $w, $t) = @_; | |
my @directions = ( |
This file contains 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 (main) where | |
import Control.Applicative | |
class Functor f => LaxMonoidalWithStrength f where | |
unit :: () -> f () | |
phi :: (f a, f b) -> f (a, b) | |
st :: (a, f b) -> f (a, b) | |
{- |
NewerOlder