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 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from numpy import newaxis, r_, c_, mat | |
from numpy.linalg import * | |
def plotData(X, y): | |
plt.plot(X, y, 'rx', markersize=7) | |
plt.ylabel('Profit in $10,000s') | |
plt.xlabel('Population of City in 10,000s') |
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 | |
import sys | |
import os | |
import datetime as dt | |
import glob | |
from BeautifulSoup import BeautifulSoup | |
def xml2srt(pathname): | |
root, _ = os.path.splitext(pathname) | |
if os.path.exists('%s.srt' % root): |
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 | |
"""(c) gorlum0 [at] gmail.com""" | |
import itertools as it | |
from sys import stdin | |
class NetworkXMessageRecovery: | |
def recover(self, messages): | |
res = [] | |
req = {} |
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
/*(c) gorlum0 [at] gmail.com*/ | |
import java.io.*; | |
import java.util.*; | |
import java.math.*; | |
public class NetworkXMessageRecovery | |
{ | |
public String recover(String[] messages) { | |
StringBuilder res = new StringBuilder(); |
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 java.io.*; | |
import java.util.*; | |
import java.math.*; | |
public class CompositeSmash | |
{ | |
HashMap<Integer, Boolean> _cache = new HashMap(); | |
boolean possible(int n, int t) { | |
if (n < t) return false; | |
if (n == t) return true; |
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 | |
"""(c) gorlum0 [at] gmail.com""" | |
import itertools as it | |
from sys import stdin | |
maxn = 10**5 | |
def get_divisors(n, _cache = {}): | |
if n not in _cache: | |
divisors = [] | |
for i in xrange(1, int(n**0.5) + 1): |
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 java.io.*; | |
import java.util.*; | |
import java.math.*; | |
public class NetworkXOneTimePad | |
{ | |
Long[] convert(String[] arr) { | |
int n = arr.length; | |
Long[] res = new Long[n]; | |
for (int i = 0; i < n; i++) |
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 python2.6 | |
"""(c) gorlum0 [at] gmail.com""" | |
from sys import stdin | |
MAXN = 10**6 | |
dp = [0] * (MAXN+1) | |
dp[0] = 1 | |
for i in xrange(MAXN+1): | |
if dp[i-7]: |
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
{-# OPTIONS_GHC -O2 -XNoMonomorphismRestriction #-} | |
{-# LANGUAGE BangPatterns #-} | |
{-(c) gorlum0 [at] gmail.com-} | |
import Data.Array | |
import Control.Monad (forM_) | |
maxn = 10^6 | |
dp :: Array Int Int | |
dp = array bnds [(i, f i) | i <- range bnds] | |
where |
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
{-# OPTIONS_GHC -O2 -XNoMonomorphismRestriction #-} | |
{-# LANGUAGE BangPatterns #-} | |
{-(c) gorlum0 [at] gmail.com-} | |
import qualified Data.Map as M | |
import qualified Data.Set as S | |
splitEvery _ [] = [] | |
splitEvery n xs = ys : splitEvery n xs' | |
where (ys, xs') = splitAt n xs |