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
use std::collections::HashMap; | |
use std::sync::{RwLock, Arc}; | |
use std::sync::atomic::{AtomicU32, Ordering}; | |
use std::cell::UnsafeCell; | |
struct MyHashTable { | |
map: RwLock<UnsafeCell<HashMap<u64, AtomicU32>>>, | |
} | |
impl MyHashTable { |
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 math | |
from tqdm import tqdm | |
from functools import cache | |
from collections import defaultdict | |
def sieve_of_Sundaram(n): | |
"""The sieve of Sundaram is a simple deterministic algorithm for finding all the prime numbers up to a specified integer.""" | |
k = (n - 2) // 2 | |
integers_list = [True] * (k + 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 math | |
from collections import Counter | |
def get_masks(size): | |
vals = [] | |
for x in range(1, 10**size): | |
val = bin(x)[2:] | |
if len(val) > size: | |
return vals |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
/* | |
Credits to the original author in the post from StackOverflow: https://stackoverflow.com/questions/24824681/how-do-i-get-the-population-count-of-an-unsigned-unchecked-number-with-boostmu | |
*/ | |
#include <bitset> | |
#include <limits> | |
#include <type_traits> | |
#include <boost/multiprecision/cpp_int.hpp> |
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 User: | |
def __init__(self, *args, **kwards): | |
self.store = args | |
self.key_store = kwards | |
def __str__(self): | |
output = 'Values\n-------\n' | |
for v in self.store: | |
output += str(v) + '\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
class User: | |
def __init__(self, *args, **kwards): | |
self.store = args | |
self.key_store = kwards | |
def __str__(self): | |
output = 'Values\n-------\n' | |
for v in self.store: | |
output += str(v) + '\n' |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 csv | |
import pandas as pd | |
from collections import defaultdict | |
header = None | |
created_sheets = defaultdict(list) | |
lc = None | |
with open('INPUT.csv') as f: | |
reader = csv.reader(f) |
NewerOlder