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 sys | |
class Queue: | |
def __init__(self, size=0): | |
self.queueObject = [] | |
self.symbols = [] | |
self.count = {} | |
self.opposites = {} | |
self.boofer = [] |
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 sys | |
class Queue: | |
def __init__(self, size=0): | |
self.queueObject = [] | |
self.symbols = [] | |
self.count = {} | |
self.opposites = {} | |
self.boofer = [] |
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
class Hashtable: | |
def __init__(self, size=29): | |
self.keys = [[]] * size | |
self.values = [[]] * size | |
self.real_keys = [] | |
self.size = size | |
def get_hash(self, something): | |
something = str(something) |
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
class Node: | |
def __init__(self, name): | |
self.name = name | |
self.neighbours = [] | |
def add_neighbour_to_self(self, neighbour): | |
self.neighbours.append(neighbour) | |
def find_neighbour_index(self, name): | |
for i in range(len(self.neighbours)): |
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
size, node = map(int, input().split()) | |
data = [list(map(int, input().split())) for _ in range(size)] | |
def get_nodes_list(graph): | |
return [[neighbour for neighbour in range(len(row)) if row[neighbour]] for row in graph] | |
def make_dict(graph): | |
nodes = get_nodes_list(graph) |
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
from math import floor | |
what_to_zip = ''' | |
Scene: A cafe. One table is occupied by a group of Vikings with horned helmets on. A man and his wife enter. | |
Man (Eric Idle): You sit here, dear. | |
Wife (Graham Chapman in drag): All right. | |
Man (to Waitress): Morning! | |
Waitress (Terry Jones, in drag as a bit of a rat-bag): Morning! | |
Man: Well, what've you got? | |
Waitress: Well, there's egg and bacon; egg sausage and bacon; egg and spam; egg bacon and spam; egg bacon sausage and spam; spam bacon sausage and spam; spam egg spam spam bacon and spam; spam sausage spam spam bacon spam tomato and spam; |
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 time | |
import random | |
import sys | |
sys.setrecursionlimit(3000) | |
def timing(f): | |
def wrap(*args): | |
time1 = time.time() | |
ret = f(*args) |