Sorry, this is too big to display.
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.
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.
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
{-# LANGUAGE OverloadedStrings #-} | |
import qualified Data.Set as S | |
import Data.String | |
import Data.List | |
type Var = String | |
data Expr = V Var | Ap Expr Expr | Lambda Var Expr | |
deriving Eq |
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 FlexibleContexts #-} | |
import Data.Array.IArray (IArray, bounds) | |
import Data.Array.Unboxed (UArray) | |
import Data.Array.Base (unsafeAt) | |
import Data.Bits (popCount, testBit) | |
permanent :: (Integral a, IArray UArray a) => UArray (Int, Int) a -> a | |
permanent arr | n == m = (if even n then negate else id) (sum entries) | |
where | |
((0, 0), (n, m)) = bounds arr |
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 <iostream> | |
#include <vector> | |
using namespace std; | |
int main() { | |
int n; | |
cin >> n; | |
vector<bool> composite(n); | |
composite[0] = true; // Technically a zero divisor | |
composite[1] = true; | |
for (int i = 2; i*i < n; ++i) { |
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
typedef long long tint; | |
tint powmod(tint a, tint k, tint n) { | |
tint b = 1; | |
while (k) { | |
if (k & 1) { | |
--k; | |
b = (b * a) % n; | |
} else { | |
k >>= 1; |
NewerOlder