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
cpp.cpp:44:18: error: non-const lvalue reference to type 'X' cannot bind to a temporary of type | |
'typename std::remove_reference<X &>::type' (aka 'X') | |
swap(std::move(other)); | |
^~~~~~~~~~~~~~~~ | |
cpp.cpp:8:22: note: passing argument to parameter 'other' here | |
void swap(X& other) noexcept | |
^ | |
cpp.cpp:65:18: error: non-const lvalue reference to type 'X' cannot bind to a temporary of type | |
'typename std::remove_reference<X &>::type' (aka 'X') | |
swap(std::move(rhs)); |
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> | |
class X { | |
private: | |
std::size_t size; | |
int *data; | |
public: | |
// You still keep the main three, the constructor, | |
// copy constructor and destructor, |
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
""" | |
usage: jlpt.py [-h] [--start START] [--question-file QUESTION_FILE] | |
Test yourself on the JLPT N1 question set | |
optional arguments: | |
-h, --help Show this help message and exit | |
--start START Question number to start from [default: 1] | |
--question-file QUESTION_FILE | |
Path to question file [default: JLPT1 Questions.json] |
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
[ | |
{ | |
"question": "子供( )我が家、子供がいなかったら、即離婚だな。", | |
"answers": ["あるべき", "あればの", "あったの", "あっての"], | |
"correct": 4 | |
}, | |
{ | |
"question": "主婦のパートだったら、時給700円から1000円( )が相場だろう。", | |
"answers": ["といったこと", "といったところ", "としたこと", "としたところ"], | |
"correct": 2 |
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
>>> python2 -m timeit -s 'r = {1, 2, 3}; s = {4, 5, 6}; t = {7, 8, 9}' '3 in reduce(lambda x,y :x.union(y),[r,s,t])' | |
1000000 loops, best of 3: 1.01 usec per loop | |
>>> python2 -m timeit -s 'r = {1, 2, 3}; s = {4, 5, 6}; t = {7, 8, 9}' '3 in r|s|t' | |
1000000 loops, best of 3: 0.399 usec per loop | |
>>> python2 -m timeit -s 'r = {1, 2, 3}; s = {4, 5, 6}; t = {7, 8, 9}' '3 in set().union(r, s, t)' | |
1000000 loops, best of 3: 0.407 usec per loop | |
>>> python2 -m timeit -s 'r = {1, 2, 3}; s = {4, 5, 6}; t = {7, 8, 9}' 'any(3 in item for item in [r,s,t])' |
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
from collections import defaultdict | |
from itertools import combinations | |
trains = {...} | |
departures = {...} | |
intersections = set() | |
stations = defaultdict(list) | |
for train, stops in trains.items(): |
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
import time | |
def main(): | |
t0 = time.time() | |
for i in range(1000000): | |
a = 1 | |
print("assignment.py", time.time()-t0) | |
t0 = time.time() | |
a = 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
@import url(https://googledrive.com/host/0BxjwQr0BBXs-aDYxM2JlaFM2bnM); | |
body { | |
background-color: rgb(42, 42, 42) !important; | |
color: rgb(255, 255, 255); | |
line-height: 2em; | |
text-shadow: 1px 1px rgb(42, 42, 42); | |
font-size: large; | |
} |
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
@import url(https://googledrive.com/host/0BxjwQr0BBXs-aDYxM2JlaFM2bnM); | |
body { | |
background-color: rgb(42, 42, 42) !important; | |
color: rgb(255, 255, 255); | |
line-height: 2em; | |
text-shadow: 1px 1px rgb(42, 42, 42); | |
} | |
#inlineContent {} |
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
% piece(?Piece). | |
% Piece is a known piece | |
piece(['74', [[1,1,0,0,1,0], [0,1,0,1,0,0], [0,1,0,0,1,0], [0,1,0,0,1,1]]]). | |
piece(['65', [[1,1,0,0,1,1], [1,0,1,1,0,0], [0,0,1,1,0,0], [0,1,0,1,0,1]]]). | |
piece(['13', [[0,1,0,1,0,1], [1,1,0,1,0,1], [1,1,0,0,1,1], [1,1,0,0,1,0]]]). | |
piece(['Cc', [[0,0,1,1,0,0], [0,0,1,1,0,0], [0,1,0,0,1,0], [0,0,1,1,0,0]]]). | |
piece(['98', [[1,1,0,0,1,0], [0,1,0,0,1,0], [0,0,1,1,0,0], [0,0,1,1,0,1]]]). | |
piece(['02', [[0,0,1,1,0,0], [0,1,0,0,1,1], [1,0,1,1,0,0], [0,0,1,1,0,0]]]). | |