Skip to content

Instantly share code, notes, and snippets.

View justiceHui's full-sized avatar
:octocat:
HelloWorld!

Jeounghui Nah justiceHui

:octocat:
HelloWorld!
View GitHub Profile
@cgiosy
cgiosy / dlas.hpp
Last active December 23, 2023 05:33
Diversified Late Acceptance Search
#ifndef DLAS_HPP
#include "intdef.hpp"
#include <array>
#include <algorithm>
#include <functional>
#include <utility>
template<class T, class U>
T incMod(T x, U mod) {
@rchrd2
rchrd2 / proxy.js
Created November 4, 2020 01:12
Cloudflare worker CORS proxy
// forked from: https://github.com/chebyrash/cors
addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
try {
const url = new URL(request.url);
if (url.pathname === "/") {
@cgiosy
cgiosy / bitset.cpp
Last active April 27, 2024 15:58
std::bitset addition & subtraction
#define private public
#include <bitset>
#undef private
#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
template<size_t _Nw> void _M_do_sub(_Base_bitset<_Nw> &A, const _Base_bitset<_Nw> &B) {
for(int i=0, c=0; i<_Nw; i++)
@cgiosy
cgiosy / _mm256_mulmod_epu32.cpp
Last active April 2, 2023 10:07
AVX2 Barrett Reduction
#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2,fma")
#include <cstdio>
#include <algorithm>
#include <x86intrin.h>
// https://arxiv.org/ftp/arxiv/papers/1407/1407.3383.pdf
struct Mod {
int m, s, n;
constexpr Mod(int const MOD): m(MOD), s(std::__lg(std::max(m, 4u)-1)-1), n((1ULL<<s+33)/m) {}
};