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
// compile with: clang++ -O3 -std=c++20 -o pqbug prioqueuebug.cpp | |
#include <iostream> | |
#include <random> | |
#include <string> | |
#include <cctype> | |
#include <forward_list> | |
#include <deque> | |
#include <queue> |
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
(in-package :pgn-tools) | |
(defun read-file (infile) | |
(with-open-file (instream infile | |
:direction | |
:input :if-does-not-exist nil) | |
(when instream | |
(let ((string (make-string (file-length instream)))) | |
(read-sequence string instream) | |
string)))) |
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
using System; | |
using BDSApp.BDS; | |
namespace BDSApp | |
{ | |
class Program | |
{ | |
static void AssertEq<T>(T a, T b) where T : IEquatable<T> | |
{ | |
if (!a.Equals(b)) |
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
{-# LANGUAGE ScopedTypeVariables #-} | |
pollard :: (Integral p, Eq p) => p -> Maybe p | |
pollard n = | |
calc 2 2 1 | |
where | |
-- calc :: p -> p -> p -> Maybe p | |
calc x y (1 :: p) = | |
let x' = g x | |
y' = g (g y) | |
d' = gcd (abs (x' - y')) n in |
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 _CRT_SECURE_NO_WARNINGS | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <windows.h> | |
static | |
size_t | |
number_of_physical_cores |
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
(declaim (optimize speed (safety 0))) | |
(eval-when (:compile-toplevel :load-toplevel :execute) | |
(load "qpc.fasl")) | |
(eval-when (:compile-toplevel :load-toplevel :execute) | |
(load "utilities.fasl")) | |
(defun grid-2d (n1 n2) | |
"grid-2d :: Int -> Int -> Lambda ( Func 'a ) | |
where | |
Func :: 'a -> Int -> Int -> Int -> Int -> 'a |
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
open Bytes | |
open Char | |
open Complex | |
let with_binary_output filename handler = | |
let ch = open_out_bin filename in | |
let result = handler ch in | |
flush ch; | |
close_out ch; | |
result |
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
#include <windows.h> | |
#include <vector> | |
#include <stack> | |
#include <variant> | |
#include <memory> | |
template<typename T> | |
struct custom_heap_allocator | |
{ | |
using value_type = T; |
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
#include "stdafx.h" | |
#include <cstdint> | |
#include <functional> | |
#include <stdexcept> | |
#include <string> | |
#include <tuple> | |
#include <iostream> | |
#include <limits> | |
#include <vector> |
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
// BSD like license: You cannot put this code under viral licenses or claim sole ownership of it. | |
// It is public domain and anyone may use it as long as they do not mess with others, using it. | |
// JSONBuilderDev.cpp : Defines the entry point for the console application. | |
// To run it on on unix systems, get rid of precompiled header include (first include) and add | |
// a few more stl headers. | |
// This code showcases how to create a JSON document builder which is easy to use. | |
// - 2 hours of coding. |