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.Either | |
import Text.Parsec | |
import Text.Parsec.String | |
import Control.Applicative hiding (many) | |
data Node = Node { | |
nCoords :: (Int, Int), | |
nSize :: Int, |
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.Either | |
import Text.Parsec | |
import Text.Parsec.String | |
import Control.Applicative hiding (many) | |
data Node = Node { | |
nCoords :: (Int, Int), | |
nSize :: Int, |
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
<?xml version="1.0"?> | |
<root> | |
<item> | |
<name>Disable left shift for backtick, 1,2,3</name> | |
<identifier>private.disable_left_shift_for_left_side</identifier> | |
<autogen>__KeyOverlaidModifier__ KeyCode::BACKQUOTE, ModifierFlag::SHIFT_L, KeyCode::VK_NONE</autogen> | |
<autogen>__KeyOverlaidModifier__ KeyCode::1, ModifierFlag::SHIFT_L, KeyCode::VK_NONE</autogen> | |
<autogen>__KeyOverlaidModifier__ KeyCode::2, ModifierFlag::SHIFT_L, KeyCode::VK_NONE</autogen> | |
<autogen>__KeyOverlaidModifier__ KeyCode::3, ModifierFlag::SHIFT_L, KeyCode::VK_NONE</autogen> | |
</item> |
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
memo = dict() | |
# Returns a list of lists of all possibilities | |
def coin_count(amount,poss,curpos): | |
if amount == 0: | |
return [[]] | |
elif amount < 0 or curpos >= len(poss): | |
return [] | |
elif (amount,curpos) in memo: # memoized | |
return memo[(amount,curpos)] |
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
# 'A' is an unsorted array of integers | |
# Find any contigous subsequence of A that sums to C. | |
def cont_subsequence_sum(A, C): | |
m = dict() # Maps number to index | |
curSum = 0 | |
m[0] = -1 | |
for i in range(len(A)): | |
curSum += A[i] | |
if( (curSum - C) in m ): | |
answer = [A[j] for j in range(m[curSum-C]+1,i+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
def prop_random(r): | |
S = sum(r) | |
i = -1 | |
rand = random.randint(1,S) | |
while(rand > 0): | |
i = i + 1 | |
rand = rand - r[i] | |
return r[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
def getMinMax(r): | |
mini = r[0] | |
maxi = r[0] | |
start = 0 | |
if len(r) % 2 != 0: | |
start = 1 | |
for i in range(start,len(r)-1,2): | |
n1 = r[i] |