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 save_array(X, filepath): | |
X = np.asarray(X) | |
shape_str = str(X.shape) | |
pd.Series(X.reshape(-1)).to_hdf(filepath, complevel=9, complib='blosc', key=shape_str) | |
def load_array(filepath): | |
with pd.io.pytables.HDFStore(filepath, mode='r') as store: |
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
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
from joblib import Parallel, delayed | |
from sklearn import model_selection | |
import lightgbm as lgb | |
import base | |
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
import tables as tb | |
import numpy as np | |
import pandas as pd | |
import os | |
import json | |
import datetime | |
import pickle | |
import inspect | |
import requests |
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
# A list of lists of ordered column groups. | |
groups_40 = [['f190486d6', '58e2e02e6', 'eeb9cd3aa'...], ...] | |
total = pd.concat([train, test], sort=False) | |
X = (total[sum(groups_40, [])].values.copy().reshape(-1, len(groups_40), 40) * 100).astype(np.int64) | |
next_values = [{} for j in range(40 - 1)] | |
for i in range(X.shape[0]): | |
for j in range(40 - 1): | |
if (X[i, :, j + 1:] != 0).sum() == 0: |
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 SafeInt64{ | |
private: | |
bool overflow = false; | |
int64_t value = 0; | |
int64_t safe_add(int64_t b){ | |
int64_t a = value; | |
int clz_a = __builtin_clzll(a > 0 ? a : -a); | |
int clz_b = __builtin_clzll(b > 0 ? b : -b); |
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
#!/usr/bin/env python | |
import argparse | |
import os | |
import subprocess | |
import sys | |
parser = argparse.ArgumentParser(description='This sctipt quickly run a c++ program.') | |
parser.add_argument('file_path', help='path to c++ program') | |
# parser.add_argument('-i', metavar='input_file', | |
# default=None, help='path to standard input file') |
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 <bits/stdc++.h> | |
using namespace std; | |
using ll = long long; | |
using P = pair<int, int>; | |
int main(){ | |
int n; | |
cin >> n; |
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
import numpy as np | |
np.random.seed(1024) | |
import pandas as pd | |
import chainer | |
from chainer import serializers | |
from chainer.optimizers import Adam | |
import chainer.functions as F | |
import chainer.links as L |
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 <bits/stdc++.h> | |
using namespace std; | |
const long long MOD = 1000000007; | |
using P = pair<int, int>; | |
using ll = long long; | |
struct MazeConstruct { | |
vector<string> construct(int k) { | |
if(k+1 <= 50) return vector<string>(1, string(k+1, '.')); | |
if(k <= 100-2) return vector<string>(50, string(k+1-49, '.')); |
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 <bits/stdc++.h> | |
using namespace std; | |
struct edge{int pu, pv, move;}; | |
struct MovingTokens { | |
int move(int n, int m, vector<int> moves) { | |
vector<edge> rev_edges[50][50]; | |
for(int j=0;j<m;j++){ | |
for(int pu=0;pu<n;pu++){ |
NewerOlder