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
from random import randint | |
from collections import defaultdict | |
from itertools import combinations | |
from tqdm import tqdm | |
P = defaultdict(int) | |
n = int(1e6) | |
for j in range(18): | |
print(j, len(P)) | |
for i in tqdm(range(n)): |
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
# stackoverflow q | |
# https://stackoverflow.com/questions/54041705/shuffling-with-constraints-on-pairs?fbclid=IwAR1WT2KRYX2YHcgwb1MPt8mRHMZbcLFonWlIwGvpcSCnb5yh9LxYKqdw_X4 | |
from random import randint | |
from operator import itemgetter | |
def pop(tmp_d, last_g=1e6): | |
tmp = [] | |
lens = {} |
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
import base64 | |
import hmac | |
import hashlib | |
import re | |
def sort_by_ascii_value(left, right): | |
if not len(left) and not len(right): | |
return 0 | |
elif not len(left) and len(right): |