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
__author__ = 'davide' | |
from collections import namedtuple, deque | |
from random import randint | |
import sys | |
import itertools as it | |
class Rect(namedtuple("_Rect", "x, y, w, h")): | |
def __contains__(self, point): |
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
__author__ = 'Kami' | |
from collections import defaultdict | |
import itertools as it | |
class MappingError(Exception): | |
pass | |
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
__author__ = "davide" | |
import struct | |
import socket | |
import argparse | |
import sys | |
from datetime import datetime | |
import time | |
from collections import defaultdict | |
from signal import signal, SIGINT, SIG_IGN |
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
__author__ = 'davide' | |
import collections | |
class Element: | |
def __init__(self, parent, rank=0, size=1): | |
self.parent = parent | |
self.rank = rank | |
self.size = size |
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
__author__ = 'davide' | |
import sys | |
import random | |
import itertools as it | |
import operator | |
from functools import lru_cache | |
from collections import Counter | |
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
module Main where | |
import Data.Char | |
import Control.Monad | |
import System.IO | |
type Token = (String, Bool) | |
mySplit :: (Char -> Bool) -> String -> [Token] | |
mySplit _ "" = [] |
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
(define factor | |
(lambda (n) | |
(let ([next (lambda (i) | |
(if (zero? (modulo i 2)) | |
(1+ i) | |
(+ 2 i)))]) | |
(let f ([n n] [i 2]) | |
(let ([d (/ n i)] [s (sqrt n)]) | |
(cond | |
[(>= i s) (list n)] |
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
#ifndef BFINTEPRETER_H_ | |
#define BFINTEPRETER_H_ | |
#include <iostream> | |
#include <cstdint> | |
#include <vector> | |
using namespace std; | |
namespace BF |
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 dyn_bitset | |
{ | |
using byte_t = uint_fast8_t; | |
private: | |
int _size, _bits; | |
byte_t* _buf; | |
public: | |
dyn_bitset(int n) |
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
__author__ = 'davide' | |
import operator | |
NO_EFFECT, NOT_EFFECTIVE, NORMAL, SUPEREFFECTIVE = range(4) | |
TYPES = list(zip(['Normale', 'Fuoco', 'Acqua', 'Elettro', 'Erba', 'Ghiaccio', | |
'Lotta', 'Veleno', 'Terra', 'Volante', 'Psico', 'Coleottero', | |
'Roccia', 'Spettro', 'Drago', 'Buio', 'Acciaio'], range(17))) |