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 <cstdio> | |
#include <limits> | |
#include <iostream> | |
using namespace std; | |
class NullType {}; | |
template<typename T, typename U> | |
class TypeList { |
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 <cstdio> | |
#include <map> | |
#include <set> | |
#include <vector> | |
using namespace std; | |
const int dx[] = {-1, 0, 1, 0}; | |
const int dy[] = {0, 1, 0, -1}; |
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 <cstdio> | |
#include <algorithm> | |
#include <iterator> | |
#include <vector> | |
using namespace std; | |
struct TestCase { | |
int N; | |
int K; |
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 <cstdio> | |
template<typename First, typename... Rest> | |
struct Tuple: public Tuple<Rest...> { | |
Tuple(First first, Rest... rest): Tuple<Rest...>(rest...), first(first) {} | |
First first; | |
}; | |
template<typename First> |
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
var HelloMessage = React.createClass({ | |
render: function() { | |
return <script>function f() { var a = 5; }</script>; | |
} | |
}); |
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 <cstdio> | |
#include <array> | |
using std::array; | |
const int MOD = 1000; | |
class ArrayWrapper { | |
const array<int, 2>& value; |
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
package io.github.ivanvergiliev; | |
public class NonVolatileFlag { | |
private static boolean flag = false; | |
public static class FlagChecker implements Runnable { | |
public void run() { | |
long iter = 0; | |
while (flag == false) { | |
++iter; |
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 <cstdlib> | |
#include <string> | |
// All of the below are not really standards-compliant, but good enough | |
// for experiments. | |
void* operator new(std::size_t size) { | |
printf("Calling new(%zu).\n", size); | |
return std::malloc(size); | |
} |
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
def transformTree(tree: Tree): Option[Tree] = { | |
val transformedLeft = if (canTransform(tree.left)) { | |
transform(tree.left) | |
} else None | |
val transformedRight = if (canTransform(tree.right)) { | |
transform(tree.right) | |
} else None | |
val result = if (transformedLeft.isDefined && transformedRight.isDefined) { |
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
def transformTree(tree: Tree): Option[Tree] = { | |
// Notice that there's no `canTranform` - we're using | |
// `transform().isDefined` to check for transformability! | |
val transformedLeft = if (transform(tree.left).isDefined) { | |
transform(tree.left) | |
} else None | |
... | |
} |
OlderNewer