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 <string> | |
#include <unordered_set> | |
#include <boost/intrusive_ptr.hpp> | |
#include <boost/noncopyable.hpp> | |
#include <gperftools/malloc_extension.h> | |
#include <assert.h> | |
#include <string.h> |
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 <boost/bind.hpp> | |
#include <boost/function.hpp> | |
#include <stdio.h> | |
class Base | |
{ | |
public: | |
virtual void foo() | |
{ | |
printf("Base::foo\n"); |
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 <stdint.h> | |
#include <algorithm> | |
#include <vector> | |
using namespace std; | |
struct IPrange | |
{ |
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
public class Main { | |
public final static int kHoles = 228; | |
public final static int kBalls = 60; | |
public static void main(String[] args) { | |
Random r = new Random(); | |
int[] hist = new int[kBalls + 1]; | |
for (int round = 0; round < 1000*1000*10; ++round) { | |
boolean[] holes = new boolean[kHoles+1]; | |
int balls = 0; |
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
/* | |
* The Computer Language Benchmarks Game | |
* http://shootout.alioth.debian.org/ | |
* | |
* contributed by Christoph Bauer | |
* modified by bearophile | |
*/ | |
#include <math.h> |
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 <algorithm> | |
#include <iterator> | |
#include <vector> | |
#include <boost/unordered_set.hpp> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <sys/time.h> | |
using namespace std; |
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 <string> | |
#include <set> | |
#include <vector> | |
#include <iostream> | |
#include <assert.h> | |
#include <stdio.h> | |
using namespace std; | |
typedef vector<string> Dictionary; |
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 <stdio.h> | |
#include <vector> | |
int buysell(const std::vector<int>& prices) | |
{ | |
assert(!prices.empty()); | |
size_t lowestBuy = 0; | |
size_t lowestBuySoFar = 0; | |
size_t highestSell = 0; |
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 <list> | |
#include <boost/unordered_map.hpp> | |
#include <boost/noncopyable.hpp> | |
template<typename T> | |
class HashedList : boost::noncopyable | |
{ | |
typedef typename std::list<T>::iterator ListIterator; | |
typedef typename std::list<T>::reverse_iterator ReverseListIterator; |
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 <algorithm> | |
#include <string.h> | |
struct AreBothSpaces | |
{ | |
bool operator()(char x, char y) const | |
{ | |
return x == ' ' && y == ' '; | |
} | |
}; |
OlderNewer