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 <fstream> | |
#include <vector> | |
#include <cmath> | |
#include <bitset> | |
#include <limits> | |
using namespace std; | |
using dist = float; | |
const dist INF = numeric_limits<dist>::max(); |
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 <fstream> | |
#include <vector> | |
#include <climits> | |
#include <exception> | |
#include <set> | |
using namespace std; | |
struct Edge { |
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
#!/usr/bin/perl -w | |
use strict; | |
use IO::Socket; | |
use Digest::SHA qw(sha256); | |
$SIG{ALRM} = sub {print "Timed out waiting for response... no fingerprint detected.\n";exit(1)}; | |
# this is an orphaned difficulty-1 block at height 1001, with a timestamp in | |
# October 2013. in practice you could generate a unique block for each | |
# individual peer you wanted to fingerprint. this block will successfully |
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
-module(fac). | |
-export([fac/1, multiply_terms/1, condense_terms/1, shuffle/1, fac_multi_actor/3]). | |
% when N >= 1000, partition into 3 sublists and distribute work amongst 3 processes | |
fac(N) when N >= 1000 -> | |
L = shuffle(lists:seq(1, N)), | |
D = trunc(N / 3), | |
FirstPart = lists:sublist(L, 1, D), | |
SecondPart = lists:sublist(L, D, D), | |
LastPart = lists:sublist(L, D*2, 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
#include <stdio.h> | |
#include <stdlib.h> | |
struct Numlist { | |
// size of the list | |
unsigned long size; | |
// the array of integers | |
unsigned int *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 <stdlib.h> | |
#include <stdio.h> | |
// Generate 1 million random 32-bit integers. | |
int main (int argc, char **argv) { | |
sranddev(); | |
int i; | |
for (i = 0; i < 1000000; i++) { | |
unsigned x = (unsigned)rand(); |
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 <fstream> | |
#include <vector> | |
#include <sstream> | |
#include <cmath> | |
struct Vertex; | |
struct Edge { | |
int v1; |