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
lst = [11, 10, 22, 10, 25] | |
ans = 1 | |
tolerance = 1e-4 | |
size = len(lst) | |
def n_merge(N): | |
ans = N | |
for i in range(1, N): | |
ans *= i**2 | |
return ans |
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 <iostream> | |
using namespace std; | |
int N, M, Q; | |
int a[2010]; | |
long long dp[2010][2010] = {0}; | |
long long rdp[2010][2010] = {0}; | |
long long accum[2010]; | |
const long long mod = 1000000007; |
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 pygame | |
from pygame.locals import * | |
import time, sys | |
import pyautogui | |
def main(): | |
pyautogui.FAILSAFE = False | |
pygame.init() | |
while True: |
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 sklearn.metrics import roc_auc_score | |
from math import sqrt | |
def roc_auc_ci(y_true, y_score, positive=1): | |
AUC = roc_auc_score(y_true, y_score) | |
N1 = sum(y_true == positive) | |
N2 = sum(y_true != positive) | |
Q1 = AUC / (2 - AUC) | |
Q2 = 2*AUC**2 / (1 + AUC) | |
SE_AUC = sqrt((AUC*(1 - AUC) + (N1 - 1)*(Q1 - AUC**2) + (N2 - 1)*(Q2 - AUC**2)) / (N1*N2)) |
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 math import sqrt | |
def partial_transposition(density_matrix: np.ndarray, basis_num_1: int=0, basis_num_2: int=0): | |
if basis_num_1 == 0 and basis_num_2 == 0: | |
basis_num_1 = int(sqrt(density_matrix.shape[0])) | |
basis_num_2 = basis_num_1 | |
elif basis_num_1 == 0: | |
basis_num_1 = int((density_matrix.shape[0])/basis_num_2) | |
elif basis_num_2 == 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 numpy as np | |
from scipy.stats.mstats import mquantiles | |
from math import sqrt, ceil | |
from matplotlib import pyplot as plt | |
def _grid_from_X(X, percentiles=(0.05, 0.95), grid_resolution=100): | |
if len(percentiles) != 2: | |
raise ValueError('percentile must be tuple of len 2') | |
if not all(0. <= x <= 1. for x in percentiles): |
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 random | |
alpha = ["A", "B", "C", "D"] | |
fishes = [1,1,1,1,1,1,1,1,1,1, | |
1,1,1,1,1,1,1,1,1,1, | |
1,1,1,1,1,1,1,1,1,1, | |
2,2,2,2,2,2,2,2,2,2, | |
2,2,2,2,2,2,2,2,2,2, | |
3,3,3,3,3,3,3,3,3,3] | |
f = random.sample(fishes, len(fishes)) |
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 pickle | |
ALPHA = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] | |
alpha = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] | |
word = input("Please Enter Words: ") | |
def plus_i(i, w): | |
if w in alpha: | |
n = alpha.index(w) + i |
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 math, tkinter, time, sys | |
g = 9.8 | |
m1 = 1 | |
m2 = 1 | |
l1 = 150 | |
l2 = 150 | |
dt = 0.1 | |
theta1 = math.pi / 2 | |
theta2 = math.pi / 2 #+ 0.02 |
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
ALPHA = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] | |
alpha = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] | |
word = input("Please Enter Words: ") | |
for i in range(len(alpha)): | |
process = "" | |
for w in word: | |
if w in alpha: | |
n = alpha.index(w) + i | |
if n > 25: |