Skip to content

Instantly share code, notes, and snippets.

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));
#include <algorithm>
class X {
private:
std::size_t size;
int *data;
public:
// You still keep the main three, the constructor,
// copy constructor and destructor,
"""
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]
[
{
"question": "子供(   )我が家、子供がいなかったら、即離婚だな。",
"answers": ["あるべき", "あればの", "あったの", "あっての"],
"correct": 4
},
{
"question": "主婦のパートだったら、時給700円から1000円(    )が相場だろう。",
"answers": ["といったこと", "といったところ", "としたこと", "としたところ"],
"correct": 2
>>> 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])'
from collections import defaultdict
from itertools import combinations
trains = {...}
departures = {...}
intersections = set()
stations = defaultdict(list)
for train, stops in trains.items():
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
@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;
}
@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 {}
% 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]]]).