- IO
N = int(input())
l = len(str(N))-1
print(l*9 + ((N+1)//(10**l)-1))
N = int(input())
l = len(str(N))-1
print(l*9 + ((N+1)//(10**l)-1))
def counts_given_parents(adj, X): | |
n, d = X.shape | |
states_list = [set(col) for col in X.T] | |
pstates_list = [Counter(map(tuple, X[:, adj.T[i]])).keys() for i in range(d)] | |
counts = {i: {j: {k: np.count_nonzero(X[:, i] == k) | |
for k in states_list[i]} | |
for j in pstates_list[i]} | |
for i in range(d)} | |
return counts |
np.hstack([np.repeat(X, len(Y), axis=0), np.tile(Y, [len(X), 1])])
これを参考に。
https://gist.github.com/filitchp/5645d5eebfefe374218fa2cbf89189aa
最後だけ以下のように。
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D INSTALL_C_EXAMPLES=OFF -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_CUDA=ON ..
import plotly | |
import plotly.offline as py | |
import plotly.graph_objs as go | |
plotly.offline.init_notebook_mode(connected=True) | |
# pos = nx.spring_layout(graph) | |
pos = nx.circular_layout(graph) | |
Xv = [v[0] for v in pos.values()] | |
Yv = [v[1] for v in pos.values()] |
pip install tqdm numpy cupy scipy scikit-learn pandas seaborn bokeh graphviz pystan chainer tensorflow keras |
if [ "$(id -u)" != "0" ]; then | |
echo "Installation was failed. Run as a super user!" 1>&2 | |
return 1 | |
fi | |
apt update && apt -y upgrade | |
apt install -y git vim w3m wget tmux vsftpd graphviz openssh-server build-essential | |
apt upgrade gcc cmake | |