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> | |
struct Node { | |
void* data; | |
Node* next; | |
}; | |
class List | |
{ | |
public: |
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
class CommandWatcher(object): | |
def __init__(self): | |
self.cmd_list = [] | |
def __del__(self): | |
print("=== command list ===") | |
print(self.__class__.__name__) | |
print(self._dumpCmd()) | |
# decorator usage |
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
namespace util | |
{ | |
template <unsigned N> | |
struct Exp2 { | |
// N & (~N + 1): get the right most set bit | |
// ex: 0x1010 -> N & (~N + 1) will obtain 0x0010 | |
// Hence N ^ (N & (~N + 1)) will unset the rightmost set bit | |
// In the end, this value will be the exponent part of associated with the leftmost set bit | |
// ex: 0x1010 -> leftmost set bit is 0x1000 -> exponent part is 3 (2^3 = 0x1000) | |
static constexpr int val = Exp2<N ^ (N & (~N +1))>::val; |
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
def print_local(var_str): | |
def local_def(): | |
print(local_def) | |
local_local = 2 | |
symtbl = locals() | |
print(symtbl) | |
if var_str in symtbl: | |
print(symtbl[var_str]) | |
else: |
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
CC = g++ -O3 | |
EXE = run | |
SO = libtestlib.so | |
all: $(SO) $(EXE) | |
$(EXE): main.cpp testlib.h | |
$(CC) -o $@ $< -ldl | |
$(SO): testlib.cpp testlib.h |
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
/* | |
* ===================================================================================== | |
* | |
* Filename: 1321C.cpp | |
* | |
* Description: codeforces 1321C. Remove Adjacent | |
* | |
* Version: 1.0 | |
* Created: 2020年03月12日 | |
* Revision: none |
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
/* | |
* ===================================================================================== | |
* | |
* Filename: 1208D.cpp | |
* | |
* Description: codeforces 1208D. Restore Permutation | |
* | |
* Version: 1.0 | |
* Created: 2019年09月05日 | |
* Revision: none |
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
/* | |
* ===================================================================================== | |
* | |
* Filename: 1208B.cpp | |
* | |
* Description: codeforces 1208B: Uniqueness | |
* | |
* Version: 1.0 | |
* Created: 2019年08月31日 | |
* Revision: none |
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
from enum import Enum | |
class DatabaseType(Enum): | |
INTEGER = 'INTEGER' | |
REAL = 'REAL' | |
TEXT = 'TEXT' | |
LIST = 'LIST' | |
MAP = 'MAP' | |
class TypeInterface: |
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 <string> | |
#include <unordered_map> | |
#include <iostream> | |
/******************************************************************************* | |
* Interfaces for Database types | |
*******************************************************************************/ | |
enum DatabaseType {INTEGER, REAL, TEXT, MAP, LIST}; | |
NewerOlder