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
cnt = {} | |
MAX_DEP = 10 | |
def traverse(dep, i, size): | |
cnt[i] = cnt.get(i, 0) + 1 | |
if dep >= MAX_DEP: return | |
for j in range(size): | |
traverse(dep + 1, i + j + 1, size + 1 - j) | |
traverse(0, 0, 1) |
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 | |
import json | |
import socket | |
import h2.connection | |
import h2.events | |
def send_response(conn, event): | |
stream_id = event.stream_id | |
response_data = json.dumps(dict(event.headers)).encode('utf-8') |
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 heapq import heappush, heappop | |
def dijkstra(N, S, edges): | |
d = [INF for i in range(N)] | |
d[S] = 0 | |
h = [] | |
heappush(h, (0, S)) | |
for i in range(N - 1): | |
min_dist, k = 0, 0 | |
if not h: break |
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 random | |
class TreapNode(object): | |
def __init__(self, key, data): | |
self.key = key | |
self.ran = random.random() | |
self.size = 1 | |
self.cnt = 1 | |
self.data = data | |
self.left = None |
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
/* | |
Snow Fall 1 - no images - Java Script | |
Visit http://rainbow.arch.scriptmania.com/scripts/ | |
for this script and many more | |
*/ | |
// Set the number of snowflakes (more than 30 - 40 not recommended) | |
var snowmax=35; | |
// Set the colors for the snow. Add as many colors as you like |
OlderNewer