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 cp. % ::, all_different | |
| import util. % transpose | |
| write_sudoku(S) => | |
| foreach (R in S) | |
| foreach (X in R) | |
| printf("%d ", X) | |
| end, | |
| printf("%n") | |
| end. |
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
| #include <assert.h> | |
| #include <stdbool.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <time.h> | |
| /// TicTacToe ========================================================================================================== | |
| typedef char Player; | |
| const Player EMPTY = ' '; |
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
| // | |
| // A solution to the problem described in | |
| // https://www.youtube.com/watch?v=_-AfhLQfb6w | |
| // | |
| // How many sets of 5, 5-letter words exist such | |
| // that the set has 25 distinct characters? | |
| // | |
| // It takes ~8sec to run on my machine. | |
| // | |
| // Usage: ./a.out < words_alpha.txt |
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 Data.Char (ord) | |
| import Data.Maybe (isJust) | |
| data CellValue = CellValue { index :: Int | |
| , row :: Int | |
| , col :: Int | |
| , box :: Int | |
| , value :: Int | |
| } |
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
| #include <queue> | |
| #include <cassert> | |
| #include <vector> | |
| #include <iostream> | |
| template <typename T> | |
| class MedianAccumulator { | |
| public: | |
| MedianAccumulator(); | |
| void operator()(T val); |
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
| // This code has been migrated to https://github.com/lakshayg/erfinv |