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
| # input | |
| # L -> the length of the log | |
| # C -> the max number of times to cut | |
| # xs -> the sorted list of possible positions to cut | |
| L, _, C = map(int, input().split()) | |
| xs = sorted(map(int, input().split())) | |
| min_val = L | |
| def solve(start): | |
| upper_bound = L |
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
| package main | |
| import ( | |
| "fmt" | |
| ) | |
| type LinkedList struct { | |
| Head *Node | |
| Tail *Node | |
| } |
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
| package main | |
| import ( | |
| "github.com/fsnotify/fsnotify" | |
| "gopkg.in/yaml.v2" | |
| "io/ioutil" | |
| "log" | |
| "reflect" | |
| "time" | |
| ) |
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
| package main | |
| import ( | |
| "errors" | |
| "fmt" | |
| "reflect" | |
| "strings" | |
| ) | |
| var errNotStruct = errors.New("anyStruct must be struct") |
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
| def get_powersets(total_set, idx=0, sets=None): | |
| if not sets: | |
| return get_subsets(total_set, idx, [[]]) | |
| if len(total_set) > idx: | |
| return get_subsets(total_set, idx+1, sets + [s + [total_set[idx]] for s in sets]) | |
| return sets |
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__('threading').Thread(target=(lambda x:lambda:[__import__('time').sleep(x),print(x)])(n)).start()for n in map(int,input().split())] |
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 bpy | |
| import math | |
| import itertools | |
| import numpy as np | |
| import pickle | |
| test_name = 'Beale' # Himmelblau, Matyas, Sphere, Rosenbrock, Rastrigin, Easom, Beale | |
| fps = 10 |
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
| def get_join_mask(*cols, unit=None): | |
| '''Return a boolean mask based on first column by extracting the index | |
| having the same value appears in every columns. If unit is specified then | |
| given columns are truncated with the unit. unit follows pandas.Series.dt accessor format. | |
| ''' | |
| if unit: | |
| try: | |
| cols = map(lambda x: x.map(operator.methodcaller(unit)), cols) | |
| except Exception as e: |
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 numpy as np | |
| from sklearn.datasets import load_breast_cancer | |
| from sklearn.model_selection import train_test_split | |
| cancer = load_breast_cancer() | |
| # this call with stratify parameter will produce | |
| # the proportion of values as same as cancer.target which is provided by stratify parameter | |
| X_train, X_test, y_train, y_test = train_test_split( | |
| cancer.data, cancer.target, stratify=cancer.target |
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
| -- below is postgresql | |
| SELECT REGEXP_REPLACE(CASH_WORDS(level*100::MONEY), | |
| 'dollars? and zero cents', | |
| '' | |
| ) x | |
| FROM generate_series(1, 100, 1) t1(level); | |
| -- below is oracle | |
| SELECT TO_CHAR(TO_DATE(level, 'J'), 'JSP') x | |
| FROM DUAL |