Skip to content

Instantly share code, notes, and snippets.

#include<assert.h>
#include<stdio.h>
int main (int argc, char *argv[])
{
FILE *fp;
int res;
long len;
fp = fopen("testappend", "wb+");
#include <stdio.h>
#include <SDL2/SDL.h>
#include <assert.h>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
int result = 1;
int done = 0;
@gsathya
gsathya / ff.md
Created July 6, 2014 01:54 — forked from paulrouget/ff.md
# usage - $python k_frequent.py log_file k
import sys
import heapq
freq = {}
# running time is O(n)
with open(sys.argv[1]) as fh:
for line in fh.readlines():
freq[line] = freq.get(line.strip(), 0) + 1
def find_min_list2(lists):
i = 0
n = len(lists)
try:
while True:
for x in range(n):
_ = lists[x][i]
i += 1
except IndexError:
@gsathya
gsathya / homebrew.patch
Last active August 29, 2015 14:04
This patch removes the annoying audible-bell on emacs. Apply the homebrew patch and install with `brew install emacs --HEAD --use-git-head`
From 604821b954478b1b10725de9f625682e97080b01 Mon Sep 17 00:00:00 2001
From: Sathyanarayanan Gunasekaran <[email protected]>
Date: Tue, 29 Jul 2014 17:26:51 -0700
Subject: [PATCH 1/1] Add patch to disable Emacs audible bell on osx
---
Library/Formula/emacs.rb | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Library/Formula/emacs.rb b/Library/Formula/emacs.rb
from collections import defaultdict
n_test_words = int(raw_input())
string_set = defaultdict(set)
substring_set = defaultdict(set)
for x in range(n_test_words):
line = raw_input()
for start in range(len(line)):
➜ src rustc queue.rs
queue.rs:4:8: 4:15 error: wrong number of type arguments: expected 1, found 0
queue.rs:4 q: RingBuf,
^~~~~~~
def _word_pattern(pattern, pattern_index, input, input_index, hashmap):
if (pattern_index == len(pattern) and input_index == len(input)):
return True;
if (pattern_index == len(pattern) or input_index == len(input)):
return False
char = pattern[pattern_index]
if char in hashmap:
def find(h, string_so_far):
if len(string_so_far) == 9:
return string_so_far[::-1]
for j, char in enumerate(letters):
if (h - j) % 37 == 0:
h = (h-j)/37
string_so_far += letters[j]
return find(h, string_so_far)
print find(956446786872726, '')