content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def find_num_1(response_list):
responses = []
for r in response_list:
responses.extend([i for i in r])
responses = list(set(responses))
return len(responses)
def find_num_2(response_list):
if len(response_list) == 0:
return 0
responses = set(response_list[0])
if len(respons... | def find_num_1(response_list):
responses = []
for r in response_list:
responses.extend([i for i in r])
responses = list(set(responses))
return len(responses)
def find_num_2(response_list):
if len(response_list) == 0:
return 0
responses = set(response_list[0])
if len(response... |
LOWER_PRIORITY = 100
LOW_PRIORITY = 75
DEFAULT_PRIORITY = 50
HIGH_PRIORITY = 25
HIGHEST_PRIORITY = 0
| lower_priority = 100
low_priority = 75
default_priority = 50
high_priority = 25
highest_priority = 0 |
class Config(object):
data = './'
activation='Relu'#Swish,Relu,Mish,Selu
init = "kaiming"#kaiming
save = './checkpoints'#save best model dir
arch = 'resnet'
depth = 50 #resnet-50
gpu_id = '0,1' #gpu id
train_data = '/home/daixiangzi/dataset/cifar-10/files/... | class Config(object):
data = './'
activation = 'Relu'
init = 'kaiming'
save = './checkpoints'
arch = 'resnet'
depth = 50
gpu_id = '0,1'
train_data = '/home/daixiangzi/dataset/cifar-10/files/train.txt'
test_data = '/home/daixiangzi/dataset/cifar-10/files/test.txt'
train_batch = 51... |
# Make an xor function
# Truth table
# | left | right | Result |
# |-------|-------|--------|
# | True | True | False |
# | True | False | True |
# | False | True | True |
# | False | False | False |
# def xor(left, right):
# return left != right
xor = lambda left, right: left != right
print(xor(True, Tr... | xor = lambda left, right: left != right
print(xor(True, True))
print(xor(True, False))
print(xor(False, True))
print(xor(False, False))
def print_powers_of(base, exp=1):
i = 1
while i <= exp:
print(base ** i)
i += 1
print_powers_of(15)
print_powers_of(exp=6, base=7)
print_powers_of(2, 5)
print_... |
class Users:
'''
Class that generates new instances of users
'''
users_list = []
def save_users(self):
'''
This method will save all users to the user list
'''
Users.users_list.append(self)
def __init__ (self,user_name,first_name,last_name,birth_mont... | class Users:
"""
Class that generates new instances of users
"""
users_list = []
def save_users(self):
"""
This method will save all users to the user list
"""
Users.users_list.append(self)
def __init__(self, user_name, first_name, last_name, birth_month, passwo... |
PREDEFINED_TORQUE_INPUTS = [
"$torque.environment.id",
"$torque.environment.virtual_network_id",
"$torque.environment.public_address",
"$torque.repos.current.current",
"$torque.repos.current.url",
"$torque.repos.current.token"
]
| predefined_torque_inputs = ['$torque.environment.id', '$torque.environment.virtual_network_id', '$torque.environment.public_address', '$torque.repos.current.current', '$torque.repos.current.url', '$torque.repos.current.token'] |
def iterate(days):
with open("inputs/day6.txt") as f:
input = [int(x) for x in f.readline().strip().split(",")]
fish = {}
for f in input:
fish[f] = fish.get(f, 0) + 1
for day in range(1, days+1):
new_fish = {}
for x in fish:
if x =... | def iterate(days):
with open('inputs/day6.txt') as f:
input = [int(x) for x in f.readline().strip().split(',')]
fish = {}
for f in input:
fish[f] = fish.get(f, 0) + 1
for day in range(1, days + 1):
new_fish = {}
for x in fish:
if x ... |
rows, cols = [int(x) for x in input().split()]
line = input()
index = 0
matrix = []
for row in range(rows):
matrix.append([None]*cols)
for col in range(cols):
if row % 2 == 0:
matrix[row][col] = line[index]
else:
matrix[row][cols - 1 - col] = line[index]
index = ... | (rows, cols) = [int(x) for x in input().split()]
line = input()
index = 0
matrix = []
for row in range(rows):
matrix.append([None] * cols)
for col in range(cols):
if row % 2 == 0:
matrix[row][col] = line[index]
else:
matrix[row][cols - 1 - col] = line[index]
index... |
class SplendaException(Exception):
def __init__(self, method_name, fake_class, spec_class):
self.fake_class = fake_class
self.spec_class = spec_class
self.method_name = method_name
def __str__(self):
spec_name = self.spec_class.__name__
fake_name = self.fake_class.__name... | class Splendaexception(Exception):
def __init__(self, method_name, fake_class, spec_class):
self.fake_class = fake_class
self.spec_class = spec_class
self.method_name = method_name
def __str__(self):
spec_name = self.spec_class.__name__
fake_name = self.fake_class.__nam... |
def chooseformat():
print("1.) fnamelname")
print("2.) fname.lname")
print("3.) fname_lname")
print("4.) finitlname")
print("5.) finit.lname")
print("6.) finit_lname")
print("7.) fname")
input("Choose a format to begin with: ")
| def chooseformat():
print('1.) fnamelname')
print('2.) fname.lname')
print('3.) fname_lname')
print('4.) finitlname')
print('5.) finit.lname')
print('6.) finit_lname')
print('7.) fname')
input('Choose a format to begin with: ') |
info = {
"UNIT_NUMBERS": {
"nul": 0,
"nulste": 0,
"een": 1,
"eerste": 1,
"twee": 2,
"tweede": 2,
"derde": 3,
"drie": 3,
"vier": 4,
"vijf": 5,
"zes": 6,
"zeven": 7,
"acht": 8,
"negen": 9
},
"DIRECT... | info = {'UNIT_NUMBERS': {'nul': 0, 'nulste': 0, 'een': 1, 'eerste': 1, 'twee': 2, 'tweede': 2, 'derde': 3, 'drie': 3, 'vier': 4, 'vijf': 5, 'zes': 6, 'zeven': 7, 'acht': 8, 'negen': 9}, 'DIRECT_NUMBERS': {'tien': 10, 'elf': 11, 'twaalf': 12, 'dertien': 13, 'veertien': 14, 'vijftien': 15, 'zestien': 16, 'zeventien': 17,... |
class Director(object):
def __init__(self, builder):
self._builder = builder
def build_computer(self):
self._builder.new_computer()
self._builder.get_case()
self._builder.build_mainboard()
self._builder.install_mainboard()
self._builder.install_hard_dr... | class Director(object):
def __init__(self, builder):
self._builder = builder
def build_computer(self):
self._builder.new_computer()
self._builder.get_case()
self._builder.build_mainboard()
self._builder.install_mainboard()
self._builder.install_hard_drive()
... |
a=2
if a<0:
print("the number is negative")
if a>0:
print("the numner is positive") | a = 2
if a < 0:
print('the number is negative')
if a > 0:
print('the numner is positive') |
class Item():
def __init__(self, name, description):
# name and description
self.name = name
self.description = description
def __str__(self):
# print item's name and description
return f"{self.name}: {self.description}" | class Item:
def __init__(self, name, description):
self.name = name
self.description = description
def __str__(self):
return f'{self.name}: {self.description}' |
#####1. Write e Python program to create e set.
# e=set()
# print(type(e))
####################################################
####2. Write e Python program to iteration over sets.
# e={'e','b','c','t'}
# for i in e:
# print(i)
####################################################
###3. Write e Python program t... | e = frozenset((358, 434, 53344, 33442, 423, 42))
print(e)
e = {358, 434, 53344, 33442889, 423, 42, 42, 42}
print(len(e)) |
########
# Copyright (c) 2020 Cloudify Platform Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | dependency_creator = 'dependency_creator'
source_deployment = 'source_deployment'
target_deployment = 'target_deployment'
target_deployment_func = 'target_deployment_func'
external_source = 'external_source'
external_target = 'external_target'
def create_deployment_dependency(dependency_creator, source_deployment=None... |
class IRCUser(object):
def __init__(self, nick, ident, host, voice=False, op=False):
self.nick = nick
self.ident = ident
self.host = host
self.set_hostmask()
self.is_voice = voice
self.is_op = op
def set_hostmask(self):
self.hostmask = "%s@%s" % (sel... | class Ircuser(object):
def __init__(self, nick, ident, host, voice=False, op=False):
self.nick = nick
self.ident = ident
self.host = host
self.set_hostmask()
self.is_voice = voice
self.is_op = op
def set_hostmask(self):
self.hostmask = '%s@%s' % (self.id... |
## https://beginnersbook.com/2018/01/python-program-check-leap-year-or-not/
def is_leap_year(year):
year = int(year);
# Leap Year Check
if year % 4 == 0 and year % 100 != 0:
return True;
elif year % 100 == 0:
print(year, "is not a Leap Year")
return False;
elif year % 400 ... | def is_leap_year(year):
year = int(year)
if year % 4 == 0 and year % 100 != 0:
return True
elif year % 100 == 0:
print(year, 'is not a Leap Year')
return False
elif year % 400 == 0:
return True
else:
return False |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
###########################################
# (c) 2016-2020 Polyvios Pratikakis
# polyvios@ics.forth.gr
###########################################
#__all__ = ['utils']
''' empty '''
| """ empty """ |
class Solution:
def prisonAfterNDays(self, cells: List[int], N: int) -> List[int]:
def nextDay(cells):
mask = cells.copy()
for i in range(1, len(cells) - 1):
if mask[i-1] ^ mask[i+1] == 0:
cells[i] = 1
else:
... | class Solution:
def prison_after_n_days(self, cells: List[int], N: int) -> List[int]:
def next_day(cells):
mask = cells.copy()
for i in range(1, len(cells) - 1):
if mask[i - 1] ^ mask[i + 1] == 0:
cells[i] = 1
else:
... |
class Subject(object):
def regist(self, observer):
pass
def unregist(self, observer):
pass
def notify(self):
pass
class Observer(object):
def update(self):
pass
class MoniterObserver(Observer):
def __init__(self, name):
self.name = name
def updat... | class Subject(object):
def regist(self, observer):
pass
def unregist(self, observer):
pass
def notify(self):
pass
class Observer(object):
def update(self):
pass
class Moniterobserver(Observer):
def __init__(self, name):
self.name = name
def update(... |
class CQueue:
''' Custom-made circular queue, which is fixed sized.
The motivation here is to have
* O(1) complexity for peeking the center part of the data
In contrast, deque has O(n) complexity
* O(1) complexity to sample from the queue (e.g., sampling replays)
'''
def __... | class Cqueue:
""" Custom-made circular queue, which is fixed sized.
The motivation here is to have
* O(1) complexity for peeking the center part of the data
In contrast, deque has O(n) complexity
* O(1) complexity to sample from the queue (e.g., sampling replays)
"""
def _... |
# This file is created by generate_build_files.py. Do not edit manually.
test_support_sources = [
"src/crypto/test/file_test.cc",
"src/crypto/test/test_util.cc",
]
def create_tests(copts):
test_support_sources_complete = test_support_sources + \
native.glob(["src/crypto/test/*.h"])
native.cc_test(
... | test_support_sources = ['src/crypto/test/file_test.cc', 'src/crypto/test/test_util.cc']
def create_tests(copts):
test_support_sources_complete = test_support_sources + native.glob(['src/crypto/test/*.h'])
native.cc_test(name='aes_test', size='small', srcs=['src/crypto/aes/aes_test.cc'] + test_support_sources_c... |
# -*- coding: utf-8 -*-
# try something like
def index():
sync.go()
return dict(message="hello from sync.py")
| def index():
sync.go()
return dict(message='hello from sync.py') |
class Solution(object):
def findDisappearedNumbers(self, nums):
Out = []
N = set(nums)
n = len(nums)
for i in range(1, n+1):
if i not in N:
Out.append(i)
return Out
nums = [4,3,2,7,8,2,3,1]
Object = Solution()
print(Object.findDisappearedNumbers(nums))
| class Solution(object):
def find_disappeared_numbers(self, nums):
out = []
n = set(nums)
n = len(nums)
for i in range(1, n + 1):
if i not in N:
Out.append(i)
return Out
nums = [4, 3, 2, 7, 8, 2, 3, 1]
object = solution()
print(Object.findDisappear... |
def matmul(a, b):
c = []
for i in range(0, len(a)):
c.append([])
for k in range(0, len(b[0])):
num = 0
for j in range(0, len(a[0])):
num += a[i][j]*b[j][k]
c[i].append(num)
return c
def main():
a = [[1,2],[3,4],[5,6]]
b = [[3,2,1]... | def matmul(a, b):
c = []
for i in range(0, len(a)):
c.append([])
for k in range(0, len(b[0])):
num = 0
for j in range(0, len(a[0])):
num += a[i][j] * b[j][k]
c[i].append(num)
return c
def main():
a = [[1, 2], [3, 4], [5, 6]]
b = [[... |
class Path:
def __init__(self, move_sequence):
self.move_sequence = move_sequence
def swap_cities(self, city1, city2):
tmp = list(self.move_sequence)
tmp[city1], tmp[city2] = tmp[city2], tmp[city1]
return Path(tuple(tmp))
def __eq__(self, other):
return self.move_se... | class Path:
def __init__(self, move_sequence):
self.move_sequence = move_sequence
def swap_cities(self, city1, city2):
tmp = list(self.move_sequence)
(tmp[city1], tmp[city2]) = (tmp[city2], tmp[city1])
return path(tuple(tmp))
def __eq__(self, other):
return self.mo... |
split_data = lambda x: [[set(j) for j in i.split("\n")] for i in x]
counter = lambda data, set_fn: sum(len(set_fn(*s)) for s in data)
if __name__ == "__main__":
with open("data.txt", "r") as file:
data = split_data(file.read().strip().split("\n\n"))
print("Part 1:", counter(data, set.union))
print... | split_data = lambda x: [[set(j) for j in i.split('\n')] for i in x]
counter = lambda data, set_fn: sum((len(set_fn(*s)) for s in data))
if __name__ == '__main__':
with open('data.txt', 'r') as file:
data = split_data(file.read().strip().split('\n\n'))
print('Part 1:', counter(data, set.union))
print... |
def pig_latin(word):
a={'a','e','i','o','u'}
#make vowels case insensitive
vowels=a|set(b.upper() for b in a)
if word[0].isalpha():
if any(i in vowels for i in word):
if word.isalnum():
if word[0] in vowels:
pig_version=word+'way'
... | def pig_latin(word):
a = {'a', 'e', 'i', 'o', 'u'}
vowels = a | set((b.upper() for b in a))
if word[0].isalpha():
if any((i in vowels for i in word)):
if word.isalnum():
if word[0] in vowels:
pig_version = word + 'way'
else:
... |
# File: S (Python 2.4)
NORMAL = 0
CUSTOM = 1
EMOTE = 2
PIRATES_QUEST = 3
TOONTOWN_QUEST = 4
| normal = 0
custom = 1
emote = 2
pirates_quest = 3
toontown_quest = 4 |
public_key = b"\x30\x81\x9f\x30\x0d\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01\x01\x05\x00\x03\x81\x8d\x00\x30\x81\x89\x02\x81\x81\x00\xd9\x7a\xcd" + \
b"\x72\x88\xaa\x98\x10\xee\x43\x50\x98\x95\x42\x98\x2d\x4d\xd7\x2c\xd6\x49\x9d\x4e\x37\x97\x53\x7a\xd3\x94\x8c\x93\x70\x22\xf1\x00" + \
b"\x4b\x4... | public_key = b'0\x81\x9f0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03\x81\x8d\x000\x81\x89\x02\x81\x81\x00\xd9z\xcd' + b'r\x88\xaa\x98\x10\xeeCP\x98\x95B\x98-M\xd7,\xd6I\x9dN7\x97Sz\xd3\x94\x8c\x93p"\xf1\x00' + b'KJF\xca\xfc\x9c\xa5\x87\xa1\x90h\xb9\x04y\x1dj 1\xa2\xe9,\xb1Q\xb9S\xceX_\x9c\xd2\xfcA' + b'$\x98\xed\x... |
####################################################
# Quiz: len, max, min, and Lists
####################################################
a = [1, 5, 8]
b = [2, 6, 9, 10]
c = [100, 200]
print(max([len(a), len(b), len(c)])) # 4
print(min([len(a), len(b), len(c)])) # 2
################################################... | a = [1, 5, 8]
b = [2, 6, 9, 10]
c = [100, 200]
print(max([len(a), len(b), len(c)]))
print(min([len(a), len(b), len(c)]))
names = ['Carol', 'Albert', 'Ben', 'Donna']
print(' & '.join(sorted(names)))
names.append('Eugenia')
print(sorted(names)) |
OPCODE = {
"add": 0, "comp": 0,
"and": 0, "xor": 0,
"shll": 0, "shrl": 0,
"shllv": 0, "shrlv": 0,
"shra": 0, "shrav": 0,
"addi": 8, "compi": 9,
"lw": 16, "sw": 24,
"b": 40, "br": 32,
"bltz": 48, "bz": 49,
"bnz": 50, "bl": 43,
"bcy": 41, "bncy": 42,
}
RFORMATS = {
"add",... | opcode = {'add': 0, 'comp': 0, 'and': 0, 'xor': 0, 'shll': 0, 'shrl': 0, 'shllv': 0, 'shrlv': 0, 'shra': 0, 'shrav': 0, 'addi': 8, 'compi': 9, 'lw': 16, 'sw': 24, 'b': 40, 'br': 32, 'bltz': 48, 'bz': 49, 'bnz': 50, 'bl': 43, 'bcy': 41, 'bncy': 42}
rformats = {'add', 'comp', 'and', 'xor', 'shll', 'shrl', 'shllv', 'shrlv... |
moves = open('input/day3-input.txt', 'r').read()
visited = set()
location = (0,0)
visited.add(location)
for move in moves:
if move == '^':
location = (location[0], location[1] + 1)
elif move == 'v':
location = (location[0], location[1] - 1)
elif move == '>':
location = (location[0] + 1, location[1])... | moves = open('input/day3-input.txt', 'r').read()
visited = set()
location = (0, 0)
visited.add(location)
for move in moves:
if move == '^':
location = (location[0], location[1] + 1)
elif move == 'v':
location = (location[0], location[1] - 1)
elif move == '>':
location = (location[0] ... |
def z3():
global bimage_mean, bimage_peak_fine, cell_dir, frame_i, nthread
nthread = 1
# load plane filename
for frame_i in range(imageframe_nmbr):
with h5py.File(output_dir + 'brain_mask' + str(frame_i) + '.hdf5', 'r') as file_handle:
image_mean = file_handle['image_mean'][()].... | def z3():
global bimage_mean, bimage_peak_fine, cell_dir, frame_i, nthread
nthread = 1
for frame_i in range(imageframe_nmbr):
with h5py.File(output_dir + 'brain_mask' + str(frame_i) + '.hdf5', 'r') as file_handle:
image_mean = file_handle['image_mean'][()].T
brain_mask = file... |
def get_virus_areas(grid):
areas = []
dangers = []
walls = []
color = [[0] * n for i in range(m)]
for i in range(m):
for j in range(n):
if grid[i][j] == 1 and color[i][j] == 0:
area = [(i, j)]
danger = set()
wall = 0
... | def get_virus_areas(grid):
areas = []
dangers = []
walls = []
color = [[0] * n for i in range(m)]
for i in range(m):
for j in range(n):
if grid[i][j] == 1 and color[i][j] == 0:
area = [(i, j)]
danger = set()
wall = 0
... |
target = df_data_card.columns[0]
class_inputs = list(df_data_card.select_dtypes(include=['object']).columns)
# impute data
df_data_card = df_data_card.fillna(df_data_card.median())
df_data_card['JOB'] = df_data_card.JOB.fillna('Other')
# dummy the categorical variables
df_data_card_ABT = pd.concat([df_data_card, pd.g... | target = df_data_card.columns[0]
class_inputs = list(df_data_card.select_dtypes(include=['object']).columns)
df_data_card = df_data_card.fillna(df_data_card.median())
df_data_card['JOB'] = df_data_card.JOB.fillna('Other')
df_data_card_abt = pd.concat([df_data_card, pd.get_dummies(df_data_card[class_inputs])], axis=1).d... |
#!/usr/bin/env python3
CENT_PER_INCH = 2.54
height_feet = int(input('Enter the "feet" part of your height: '))
height_inches = int(input('Enter the "inches" part of your height: '))
total_height_inches = height_feet * 12 + height_inches
total_cent = total_height_inches * CENT_PER_INCH
print(f"Your height of {heigh... | cent_per_inch = 2.54
height_feet = int(input('Enter the "feet" part of your height: '))
height_inches = int(input('Enter the "inches" part of your height: '))
total_height_inches = height_feet * 12 + height_inches
total_cent = total_height_inches * CENT_PER_INCH
print(f"Your height of {height_feet}'{height_inches} is {... |
# Copyright 2013 Google, Inc. All Rights Reserved.
#
# Google Author(s): Behdad Esfahbod, Roozbeh Pournader
class Options(object):
class UnknownOptionError(Exception):
pass
def __init__(self, **kwargs):
self.verbose = False
self.timing = False
self.drop_tables = []
self.set(**kwargs)
def set(self, *... | class Options(object):
class Unknownoptionerror(Exception):
pass
def __init__(self, **kwargs):
self.verbose = False
self.timing = False
self.drop_tables = []
self.set(**kwargs)
def set(self, **kwargs):
for (k, v) in kwargs.items():
if not hasatt... |
def remove_void(lst:list):
return list(filter(None, lst))
def remove_double_back(string:str):
string.replace("\n\n","@@@@@").replace("\n","").replace("@@@@@","")
def pretty_print(dct:dict):
for val,key in dct.items():
print(val)
for el in key:
print("\t",el)
print("\n") | def remove_void(lst: list):
return list(filter(None, lst))
def remove_double_back(string: str):
string.replace('\n\n', '@@@@@').replace('\n', '').replace('@@@@@', '')
def pretty_print(dct: dict):
for (val, key) in dct.items():
print(val)
for el in key:
print('\t', el)
p... |
n=int(input())
for i in range(1,n+1):
for j in range(1,i+1):
print(j,end="")
print()
for i in range(1,n):
for j in range(n-i):
print(j+1,end="")
print() | n = int(input())
for i in range(1, n + 1):
for j in range(1, i + 1):
print(j, end='')
print()
for i in range(1, n):
for j in range(n - i):
print(j + 1, end='')
print() |
#
# PySNMP MIB module HUAWEI-UNIMNG-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-UNIMNG-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:37:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, value_size_constraint, value_range_constraint, constraints_union) ... |
def kill_timer(timer):
timer.cancel()
def init():
global timeout_add
global timeout_end
timeout_add = pyjd.gobject.timeout_add
timeout_end = kill_timer
| def kill_timer(timer):
timer.cancel()
def init():
global timeout_add
global timeout_end
timeout_add = pyjd.gobject.timeout_add
timeout_end = kill_timer |
#!/usr/bin/python3
class _LockCtx(object):
__slots__ = ( "__evt", "__bPreventFiringOnUnlock" )
def __init__(self, evt, bPreventFiringOnUnlock:bool = False):
self.__evt = evt
self.__bPreventFiringOnUnlock = bPreventFiringOnUnlock
#
def dump(self):
print("_LockCtx(")
print("\t__evt = " + str(self.__evt... | class _Lockctx(object):
__slots__ = ('__evt', '__bPreventFiringOnUnlock')
def __init__(self, evt, bPreventFiringOnUnlock: bool=False):
self.__evt = evt
self.__bPreventFiringOnUnlock = bPreventFiringOnUnlock
def dump(self):
print('_LockCtx(')
print('\t__evt = ' + str(self.__... |
datasetPath = "/storage/mstrobl/dataset"
waveformPath = "/storage/mstrobl/waveforms"
featurePath = "/storage/mstrobl/features/"
quantumPath = "/storage/mstrobl/quantum/"
modelsPath = "/storage/mstrobl/models"
testDatasetPath = "/storage/mstrobl/testDataset"
testWaveformPath = "/storage/mstrobl/testWaveforms"
testFeatu... | dataset_path = '/storage/mstrobl/dataset'
waveform_path = '/storage/mstrobl/waveforms'
feature_path = '/storage/mstrobl/features/'
quantum_path = '/storage/mstrobl/quantum/'
models_path = '/storage/mstrobl/models'
test_dataset_path = '/storage/mstrobl/testDataset'
test_waveform_path = '/storage/mstrobl/testWaveforms'
t... |
def one_line():
output = []
with open("toChris.txt", "r") as f:
line = f.readline()
counter = 0
temp = []
while line:
if "{" in line:
counter += 1
elif "}" in line:
counter -= 1
temp.append(line)
if... | def one_line():
output = []
with open('toChris.txt', 'r') as f:
line = f.readline()
counter = 0
temp = []
while line:
if '{' in line:
counter += 1
elif '}' in line:
counter -= 1
temp.append(line)
if c... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
module: win_dfs_namespace_root
short_description: Set up a DFS namespace.
description:
- This module creates/man... | ansible_metadata = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'}
documentation = "\nmodule: win_dfs_namespace_root\nshort_description: Set up a DFS namespace.\n\ndescription:\n - This module creates/manages Windows DFS namespaces.\n - Prior to using this module it's required to insta... |
#
# PySNMP MIB module CISCO-RTTMON-IP-EXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-RTTMON-IP-EXT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:11:15 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_intersection, constraints_union, value_range_constraint) ... |
#
# PySNMP MIB module Argus-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Argus-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:33:18 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, constraints_union, value_size_constraint, constraints_intersection) ... |
parrot = "Norwegian Blue"
print(parrot)
print(parrot[3])
print(parrot[4])
print(parrot[9])
print(parrot[3])
print(parrot[6])
print(parrot[8])
| parrot = 'Norwegian Blue'
print(parrot)
print(parrot[3])
print(parrot[4])
print(parrot[9])
print(parrot[3])
print(parrot[6])
print(parrot[8]) |
def bool_prompt(msg: str) -> bool:
while True:
response = input(f"{msg} [y/n]: ").lower()
if response == "y":
return True
elif response == "n":
return False
else:
print(f"'{response}' is an invalid option.")
| def bool_prompt(msg: str) -> bool:
while True:
response = input(f'{msg} [y/n]: ').lower()
if response == 'y':
return True
elif response == 'n':
return False
else:
print(f"'{response}' is an invalid option.") |
class node_values:
def __init__(self, iden, value):
self.iden = iden
self.value = value
def get_iden(self):
return self.iden
def set_iden(self, iden):
self.iden = iden
def get_value(self):
return self.value
def set_value(self, value):
self.value = ... | class Node_Values:
def __init__(self, iden, value):
self.iden = iden
self.value = value
def get_iden(self):
return self.iden
def set_iden(self, iden):
self.iden = iden
def get_value(self):
return self.value
def set_value(self, value):
self.value =... |
class Person:
def __init__(self, first_name, last_name):
self.first = first_name
self.last = last_name
def speak(self):
print("My name is "+ self.first+" "+self.last)
me = Person("Brandon", "Walsh")
you = Person("Ethan", "Reed")
me.speak()
you.speak() | class Person:
def __init__(self, first_name, last_name):
self.first = first_name
self.last = last_name
def speak(self):
print('My name is ' + self.first + ' ' + self.last)
me = person('Brandon', 'Walsh')
you = person('Ethan', 'Reed')
me.speak()
you.speak() |
def minRemove(arr, n):
LIS = [0 for i in range(n)]
len = 0
for i in range(n):
LIS[i] = 1
for i in range(1, n):
for j in range(i):
if (arr[i] > arr[j] and (i - j) <= (arr[i] - arr[j])):
LIS[i] = max(LIS[i], LIS[j] + 1)
len = max(len, LIS[i])
return ... | def min_remove(arr, n):
lis = [0 for i in range(n)]
len = 0
for i in range(n):
LIS[i] = 1
for i in range(1, n):
for j in range(i):
if arr[i] > arr[j] and i - j <= arr[i] - arr[j]:
LIS[i] = max(LIS[i], LIS[j] + 1)
len = max(len, LIS[i])
return n - l... |
# -*- coding:utf-8 -*-
'''
For example, the number 7 is a "happy" number:
72 = 49 --> 42 + 92 = 97 --> 92 + 72 = 130 --> 12 + 32 + 02 = 10 --> 12 + 02 = 1
Once the sequence reaches the number 1, it will stay there forever since 12 = 1
On the other hand, the number 6 is not a happy number as the sequence th... | """
For example, the number 7 is a "happy" number:
72 = 49 --> 42 + 92 = 97 --> 92 + 72 = 130 --> 12 + 32 + 02 = 10 --> 12 + 02 = 1
Once the sequence reaches the number 1, it will stay there forever since 12 = 1
On the other hand, the number 6 is not a happy number as the sequence that is generated is the following:... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Carson Anderson <rcanderson23@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# this is a windows documentation stub. actual code lives in the .ps1
# file of the same name
ANSIBLE_METADATA = {'me... | ansible_metadata = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'}
documentation = '\n---\nmodule: win_optional_feature\nversion_added: "2.8"\nshort_description: Manage optional Windows features\ndescription:\n - Install or uninstall optional Windows features on non-Server Windows.\n ... |
a = input ()
b = input ()
c=a
a=b
b=c
print (a, b)
| a = input()
b = input()
c = a
a = b
b = c
print(a, b) |
class Bird:
def about(self):
print("Species: Bird")
def Dance(self):
print("Not all but some birds can dance")
class Peacock(Bird):
def Dance(self):
print("Peacock can dance")
class Sparrow(Bird):
def Dance(self):
print("Sparrow can't dance")
| class Bird:
def about(self):
print('Species: Bird')
def dance(self):
print('Not all but some birds can dance')
class Peacock(Bird):
def dance(self):
print('Peacock can dance')
class Sparrow(Bird):
def dance(self):
print("Sparrow can't dance") |
def quickSort(alist, first, last):
if (first < last):
splitpoint = partition(alist, first, last)
quickSort(alist, first, splitpoint - 1)
quickSort(alist, splitpoint + 1, last)
def partition(alist, first, last):
pivotvalue = alist[first]
leftmark = first +1
rightmark = ... | def quick_sort(alist, first, last):
if first < last:
splitpoint = partition(alist, first, last)
quick_sort(alist, first, splitpoint - 1)
quick_sort(alist, splitpoint + 1, last)
def partition(alist, first, last):
pivotvalue = alist[first]
leftmark = first + 1
rightmark = last
... |
def lcsv(str_or_list):
''' List of Comma-Separated Values.
Convert a str of comma-separated values to a list over the items, or
convert such a list back to a comma-separated string.
This function does not understand quotes.
See the unit tests for examples of how ``lcsv`` works.
'''
if isi... | def lcsv(str_or_list):
""" List of Comma-Separated Values.
Convert a str of comma-separated values to a list over the items, or
convert such a list back to a comma-separated string.
This function does not understand quotes.
See the unit tests for examples of how ``lcsv`` works.
"""
if isi... |
#
# PySNMP MIB module PDN-XDSL-INTERFACE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PDN-XDSL-INTERFACE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:31:00 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection, constraints_union) ... |
def _FindNonRepeat(_InputString, chars):
count = 0
_NonRepeat = {}
for i in chars:
count = _InputString.count(i)
if count > 1:
print(count,i)
if count == 1:
_NonRepeat[count] = i
#print(_NonRepeat)
return(_NonRepeat)
def _FindNonRepeat2(... | def __find_non_repeat(_InputString, chars):
count = 0
__non_repeat = {}
for i in chars:
count = _InputString.count(i)
if count > 1:
print(count, i)
if count == 1:
_NonRepeat[count] = i
return _NonRepeat
def __find_non_repeat2(_InputString, chars):
ret... |
a=[1,2,3,4,5]
a=a[::-1]
print (a)
a=[1,1,2,2,2,2,3,3,3]
b=2
print(a.count(b))
a='ana are mere si nu are pere'
b=a.split()
c=len(b)
print(c) | a = [1, 2, 3, 4, 5]
a = a[::-1]
print(a)
a = [1, 1, 2, 2, 2, 2, 3, 3, 3]
b = 2
print(a.count(b))
a = 'ana are mere si nu are pere'
b = a.split()
c = len(b)
print(c) |
class ContactHelper:
def __init__(self, app):
self.app = app
def create(self, contact):
wd = self.app.wd
wd.find_element_by_link_text("add new").click()
wd.find_element_by_name("firstname").click()
wd.find_element_by_name("firstname").clear()
wd.find_element_by... | class Contacthelper:
def __init__(self, app):
self.app = app
def create(self, contact):
wd = self.app.wd
wd.find_element_by_link_text('add new').click()
wd.find_element_by_name('firstname').click()
wd.find_element_by_name('firstname').clear()
wd.find_element_by_... |
FAST_NULL = 0x000
FAST_NOON = 0x201
FAST_SUNSET = 0x202
FAST_MOONRISE = 0x203
FAST_DUSK = 0x204
FAST_MIDNIGHT = 0x205
FAST_EKADASI = 0x206
FAST_DAY = 0x207
| fast_null = 0
fast_noon = 513
fast_sunset = 514
fast_moonrise = 515
fast_dusk = 516
fast_midnight = 517
fast_ekadasi = 518
fast_day = 519 |
memo = {1: 1, 2: 2, 3: 4}
def climb(n):
if n == 1:
return 1
elif n == 2:
return 2
elif n == 3:
return 4
else:
c = 0
for i in [1, 2, 3]:
t = memo.get(n - i)
if not t:
memo[n - 1] = climb(n - 1)
c += memo.get(n... | memo = {1: 1, 2: 2, 3: 4}
def climb(n):
if n == 1:
return 1
elif n == 2:
return 2
elif n == 3:
return 4
else:
c = 0
for i in [1, 2, 3]:
t = memo.get(n - i)
if not t:
memo[n - 1] = climb(n - 1)
c += memo.get(n - ... |
# pylint: skip-file
computing.ubm_training_workers = 8
computing.ivector_dataloader_workers = 22
computing.feature_extraction_workers = 22
computing.use_gpu = True
computing.gpu_ids = (0,)
paths.output_folder = '/media/ssd2/vvestman/sitw_ivector_outputs'
paths.feature_and_list_folder = 'datasets' # No need to update... | computing.ubm_training_workers = 8
computing.ivector_dataloader_workers = 22
computing.feature_extraction_workers = 22
computing.use_gpu = True
computing.gpu_ids = (0,)
paths.output_folder = '/media/ssd2/vvestman/sitw_ivector_outputs'
paths.feature_and_list_folder = 'datasets'
paths.kaldi_recipe_folder = '/media/hdd2/v... |
numbers = [111, 7, 2, 1]
print(len(numbers))
print(numbers)
###
numbers.append(4)
print(len(numbers))
print(numbers)
###
numbers.insert(0, 222)
print(len(numbers))
print(numbers)
#
my_list = [] # Creating an empty list.
for i in range(5):
my_list.append(i + 1)
print(my_list)
my_list = [] # Creating an ... | numbers = [111, 7, 2, 1]
print(len(numbers))
print(numbers)
numbers.append(4)
print(len(numbers))
print(numbers)
numbers.insert(0, 222)
print(len(numbers))
print(numbers)
my_list = []
for i in range(5):
my_list.append(i + 1)
print(my_list)
my_list = []
for i in range(5):
my_list.insert(0, i + 1)
print(my_list)
... |
# -*- coding: utf-8 -*-
ICX_TO_LOOP = 10 ** 18
LOOP_TO_ISCORE = 1000
def icx(value: int) -> int:
return value * ICX_TO_LOOP
def loop_to_str(value: int) -> str:
if value == 0:
return "0"
sign: str = "-" if value < 0 else ""
integer, exponent = divmod(abs(value), ICX_TO_LOOP)
if exponent... | icx_to_loop = 10 ** 18
loop_to_iscore = 1000
def icx(value: int) -> int:
return value * ICX_TO_LOOP
def loop_to_str(value: int) -> str:
if value == 0:
return '0'
sign: str = '-' if value < 0 else ''
(integer, exponent) = divmod(abs(value), ICX_TO_LOOP)
if exponent == 0:
return f'{s... |
# http://codeforces.com/problemset/problem/34/A
n = int(input())
heights = [int(x) for x in input().split()]
soldiers = [x for x in range(1, n + 1)]
heights.append(heights[0])
soldiers.append(soldiers[0])
first_min = 0
second_min = 0
difference_min = 999999999999999999999999
for i in range(len(height... | n = int(input())
heights = [int(x) for x in input().split()]
soldiers = [x for x in range(1, n + 1)]
heights.append(heights[0])
soldiers.append(soldiers[0])
first_min = 0
second_min = 0
difference_min = 999999999999999999999999
for i in range(len(heights) - 1):
difference = abs(heights[i] - heights[i + 1])
if d... |
# return n * (n+1) / 2
with open('./input', encoding='utf8') as file:
coord_strs = file.readline().strip()[12:].split(', ')
x_range = [int(val) for val in coord_strs[0].split('=')[1].split('..')]
y_range = [int(val) for val in coord_strs[1].split('=')[1].split('..')]
y_speed = abs(y_range[0])-1
print(y_s... | with open('./input', encoding='utf8') as file:
coord_strs = file.readline().strip()[12:].split(', ')
x_range = [int(val) for val in coord_strs[0].split('=')[1].split('..')]
y_range = [int(val) for val in coord_strs[1].split('=')[1].split('..')]
y_speed = abs(y_range[0]) - 1
print(y_speed * (y_speed + 1) / 2... |
DEFAULT_CELERY_BROKER_LOGIN_METHOD = 'AMQPLAIN'
DEFAULT_CELERY_BROKER_URL = None
DEFAULT_CELERY_BROKER_USE_SSL = None
DEFAULT_CELERY_RESULT_BACKEND = None
| default_celery_broker_login_method = 'AMQPLAIN'
default_celery_broker_url = None
default_celery_broker_use_ssl = None
default_celery_result_backend = None |
A, B ,C= map(int, input().split())
D=int(input())
C+=D
if C>59:
B+=C//60
C=C%60
if B>59:
A+=B//60
B=B%60
if A>23:
A=A%24
print(A,B,C)
else:
print(A,B,C)
else:
print(A,B,C)
else:
print(A,B,C) | (a, b, c) = map(int, input().split())
d = int(input())
c += D
if C > 59:
b += C // 60
c = C % 60
if B > 59:
a += B // 60
b = B % 60
if A > 23:
a = A % 24
print(A, B, C)
else:
print(A, B, C)
else:
print(A, B, C)
else:
print(A... |
def makeprefixsum(nums):
prefixsum = [0] * (len(nums) + 1)
for i in range(1, len(nums)+1):
prefixsum[i] = prefixsum[i-1] + nums[i-1]
return prefixsum
def rsq(prefixsum, l, r): # Range Sum Query
return prefixsum[r] - prefixsum[l]
def countzeroes(nums, l, r):
cnt = 0 # complexity O(NM) N ... | def makeprefixsum(nums):
prefixsum = [0] * (len(nums) + 1)
for i in range(1, len(nums) + 1):
prefixsum[i] = prefixsum[i - 1] + nums[i - 1]
return prefixsum
def rsq(prefixsum, l, r):
return prefixsum[r] - prefixsum[l]
def countzeroes(nums, l, r):
cnt = 0
for i in range(i, r):
if... |
number_of_nice_strings=0
with open("input.txt") as input:
for line in input:
line=line.rstrip()
#chack vowels
num_of_vowels=0
vowels=["a","e","i","o","u"]
vowels_dict={}
for vowel in vowels:
if vowel in line:
vowels_dict[vowel] = line.coun... | number_of_nice_strings = 0
with open('input.txt') as input:
for line in input:
line = line.rstrip()
num_of_vowels = 0
vowels = ['a', 'e', 'i', 'o', 'u']
vowels_dict = {}
for vowel in vowels:
if vowel in line:
vowels_dict[vowel] = line.count(vowel)
... |
data1 = {
'board': {
'snakes': [
{'body': [
{'x': 5, 'y': 5},
{'x': 5, 'y': 6},
{'x': 4, 'y': 6},
{'x': 3, 'y': 6},
{'x': 3, 'y': 5},
{'x': 3, 'y': 4},
{'x': 4, 'y': 4},
... | data1 = {'board': {'snakes': [{'body': [{'x': 5, 'y': 5}, {'x': 5, 'y': 6}, {'x': 4, 'y': 6}, {'x': 3, 'y': 6}, {'x': 3, 'y': 5}, {'x': 3, 'y': 4}, {'x': 4, 'y': 4}, {'x': 5, 'y': 4}, {'x': 6, 'y': 4}, {'x': 7, 'y': 4}], 'health': 100, 'id': 'testsnake', 'length': 10, 'name': 'testsnake', 'object': 'snake'}], 'height':... |
# python 3.6
def camel2pothole(string):
rst = "".join(["_" + s.lower() if s == s.upper() or s.isdigit() else s for s in string])
return rst
print(camel2pothole("codingDojang"))
print(camel2pothole("numGoat30")) | def camel2pothole(string):
rst = ''.join(['_' + s.lower() if s == s.upper() or s.isdigit() else s for s in string])
return rst
print(camel2pothole('codingDojang'))
print(camel2pothole('numGoat30')) |
browsers = [
{
'id': 'chrome',
'name': 'Chrome'
},
{
'id': 'chromium',
'name': 'Chromium'
},
{
'id': 'firefox',
'name': 'Firefox'
},
{
'id': 'safari',
'name': 'Safari'
},
{
'id': 'msie',
'name': 'Internet Explorer'
},
{
'id': 'mse... | browsers = [{'id': 'chrome', 'name': 'Chrome'}, {'id': 'chromium', 'name': 'Chromium'}, {'id': 'firefox', 'name': 'Firefox'}, {'id': 'safari', 'name': 'Safari'}, {'id': 'msie', 'name': 'Internet Explorer'}, {'id': 'msedge', 'name': 'Microsoft Edge'}, {'id': 'opera', 'name': 'Opera'}, {'id': 'yandexbrowser', 'name': 'Ya... |
N, K, S = [int(n) for n in input().split()]
ans = []
for i in range(N-K):
ans.append(S+1 if S<10**9 else 1)
for j in range(K):
ans.append(S)
print(" ".join([str(n) for n in ans]))
| (n, k, s) = [int(n) for n in input().split()]
ans = []
for i in range(N - K):
ans.append(S + 1 if S < 10 ** 9 else 1)
for j in range(K):
ans.append(S)
print(' '.join([str(n) for n in ans])) |
#Binary Tree Level Order BFS&DFS
class Solution(object):
def levelOrder(self, root):
if not root:
return []
result = []
queue = collections.deque()
queue.append(root)
#visited = set(root)
while queue:
level_size = len(queue)
cur... | class Solution(object):
def level_order(self, root):
if not root:
return []
result = []
queue = collections.deque()
queue.append(root)
while queue:
level_size = len(queue)
current_level = []
for _ in range(level_size):
... |
# Python Learning Lessons
some_var = int(input("Give me a number, any number: "))
if some_var > 10:
print("The number is bigger than tenerooonie.")
elif some_var < 10:
print("The numbah is smaller than 10.")
elif some_var == 10:
("YO. The numbah is TEN!")
some_name = str(input("Hey, what's your name... | some_var = int(input('Give me a number, any number: '))
if some_var > 10:
print('The number is bigger than tenerooonie.')
elif some_var < 10:
print('The numbah is smaller than 10.')
elif some_var == 10:
'YO. The numbah is TEN!'
some_name = str(input("Hey, what's your name, kid: "))
print('Pleasure to meet y... |
class SubClass():
def __init__(self):
self.message = 'init - SubFile - mtulio.example.sub Class'
def returnMessage(self):
return self.message
def subMessageHelloWorld():
return 'init - SubFile - mtulio.example.sub Method'
| class Subclass:
def __init__(self):
self.message = 'init - SubFile - mtulio.example.sub Class'
def return_message(self):
return self.message
def sub_message_hello_world():
return 'init - SubFile - mtulio.example.sub Method' |
# coding=utf-8
# *** WARNING: this file was generated by crd2pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
SNAKE_TO_CAMEL_CASE_TABLE = {
"api_version": "apiVersion",
"attacher_node_selector": "attacherNodeSelector",
"driver_registrar": "driverRegistrar",
"... | snake_to_camel_case_table = {'api_version': 'apiVersion', 'attacher_node_selector': 'attacherNodeSelector', 'driver_registrar': 'driverRegistrar', 'gui_host': 'guiHost', 'gui_port': 'guiPort', 'image_pull_secrets': 'imagePullSecrets', 'inode_limit': 'inodeLimit', 'k8s_node': 'k8sNode', 'node_mapping': 'nodeMapping', 'p... |
STATS = [
{
"num_node_expansions": NaN,
"plan_length": 35,
"search_time": 7.93,
"total_time": 7.93
},
{
"num_node_expansions": NaN,
"plan_length": 34,
"search_time": 9.72,
"total_time": 9.72
},
{
"num_node_expansions": NaN,
... | stats = [{'num_node_expansions': NaN, 'plan_length': 35, 'search_time': 7.93, 'total_time': 7.93}, {'num_node_expansions': NaN, 'plan_length': 34, 'search_time': 9.72, 'total_time': 9.72}, {'num_node_expansions': NaN, 'plan_length': 40, 'search_time': 15.54, 'total_time': 15.54}, {'num_node_expansions': NaN, 'plan_leng... |
def a():
pass
# This is commented
# out
| def a():
pass |
def makeArrayConsecutive2(statues):
'''Ratiorg got statues of different sizes as a present from CodeMaster
for his birthday, each statue having an non-negative integer size.
Since he likes to make things perfect, he wants to arrange them from
smallest to largest so that each statue will be ... | def make_array_consecutive2(statues):
"""Ratiorg got statues of different sizes as a present from CodeMaster
for his birthday, each statue having an non-negative integer size.
Since he likes to make things perfect, he wants to arrange them from
smallest to largest so that each statue will b... |
def is_list(v):
return isinstance(v, list)
def is_list_of_type(v, t):
return is_list(v) and all(isinstance(e, t) for e in v)
def flatten_indices(indices):
# indices could be nested nested list, we convert them to nested list
# if indices is not a list, then there is something wrong
if not is_list(indi... | def is_list(v):
return isinstance(v, list)
def is_list_of_type(v, t):
return is_list(v) and all((isinstance(e, t) for e in v))
def flatten_indices(indices):
if not is_list(indices):
raise value_error('indices is not a list')
if is_list_of_type(indices, int):
return indices
flat_ind... |
s1 = "HELLO BEGINNERS"
print(s1.casefold()) # -- CF1
s2 = "Hello Beginners"
print(s2.casefold()) # -- CF2
if s1.casefold() == s2.casefold(): # -- CF3
print("Both the strings are same after conversion")
else:
print("Both the strings are different after conversion ")
| s1 = 'HELLO BEGINNERS'
print(s1.casefold())
s2 = 'Hello Beginners'
print(s2.casefold())
if s1.casefold() == s2.casefold():
print('Both the strings are same after conversion')
else:
print('Both the strings are different after conversion ') |
n = list(map(int, input("[>] Enter numbers: ").split()))
n.sort()
for i in range(3):
for j in range(3):
print(f"{n[i]} + {n[j]} = {n[i] + n[j]}", end="\t")
print()
| n = list(map(int, input('[>] Enter numbers: ').split()))
n.sort()
for i in range(3):
for j in range(3):
print(f'{n[i]} + {n[j]} = {n[i] + n[j]}', end='\t')
print() |
class Solution:
def sortColors(self, nums: List[int]) -> None:
# If 2, put it at the tail
# if 0, put it at the head and move idx to next
# If 1, move idx to next
idx = 0
for _ in range(len(nums)):
if nums[idx] == 2:
nums.append(nums.pop(i... | class Solution:
def sort_colors(self, nums: List[int]) -> None:
idx = 0
for _ in range(len(nums)):
if nums[idx] == 2:
nums.append(nums.pop(idx))
continue
elif nums[idx] == 0:
nums.insert(0, nums.pop(idx))
idx += 1 |
{
'targets': [
{
'conditions': [
[ 'OS != "linux"', {
'target_name': 'procps_only_supported_on_linux',
} ],
[ 'OS == "linux"', {
'target_name': 'procps',
'sources': [
'src/procps.cc'
, 'src/proc.cc'
, 'src/diskstat... | {'targets': [{'conditions': [['OS != "linux"', {'target_name': 'procps_only_supported_on_linux'}], ['OS == "linux"', {'target_name': 'procps', 'sources': ['src/procps.cc', 'src/proc.cc', 'src/diskstat.cc', 'src/partitionstat.cc', 'src/slabcache.cc', 'deps/procps/proc/alloc.c', 'deps/procps/proc/devname.c', 'deps/procps... |
ROMAN = 'IVXLCDM'
def get_list_from_number(number):
return [int(num) for num in str(number)]
def get_roman_from_base(base_indexes, magnitude):
roman = ""
for i in base_indexes:
roman += ROMAN[i + magnitude*2]
return roman
def convert_number_to_base_indexes(number):
# Convert a number to a... | roman = 'IVXLCDM'
def get_list_from_number(number):
return [int(num) for num in str(number)]
def get_roman_from_base(base_indexes, magnitude):
roman = ''
for i in base_indexes:
roman += ROMAN[i + magnitude * 2]
return roman
def convert_number_to_base_indexes(number):
base_indexes = ['', '... |
# SPDX-FileCopyrightText: 2020 - Sebastian Ritter <bastie@users.noreply.github.com>
# SPDX-License-Identifier: Apache-2.0
'''
## *J*ust *a* *v*ampire *A*PI ##
As same as bloodhound let us reimplement the Java API.
This is similar to long time ago
[JavAPI](https://github.com/RealBastie/JavApi) project.
###... | """
## *J*ust *a* *v*ampire *A*PI ##
As same as bloodhound let us reimplement the Java API.
This is similar to long time ago
[JavAPI](https://github.com/RealBastie/JavApi) project.
### The Idea ###
Too many good programming languages are looking for developers hype.
Maybe You believe to coding in all i... |
class Meal:
def __init__(self,id,name,photo_url,details,price):
self.id = id
self.name = name
self.photo_url = photo_url
self.details = details
self.price = price
meal_list = []
orders_list = []
class Customer:
def get_all(self):
return meal_list
def get_me... | class Meal:
def __init__(self, id, name, photo_url, details, price):
self.id = id
self.name = name
self.photo_url = photo_url
self.details = details
self.price = price
meal_list = []
orders_list = []
class Customer:
def get_all(self):
return meal_list
def ... |
self.description = "Sysupgrade with a sync package having higher epoch"
sp = pmpkg("dummy", "1:1.0-1")
self.addpkg2db("sync", sp)
lp = pmpkg("dummy", "1.1-1")
self.addpkg2db("local", lp)
self.args = "-Su"
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_VERSION=dummy|1:1.0-1")
| self.description = 'Sysupgrade with a sync package having higher epoch'
sp = pmpkg('dummy', '1:1.0-1')
self.addpkg2db('sync', sp)
lp = pmpkg('dummy', '1.1-1')
self.addpkg2db('local', lp)
self.args = '-Su'
self.addrule('PACMAN_RETCODE=0')
self.addrule('PKG_VERSION=dummy|1:1.0-1') |
attacks_listing = {}
listing_by_name = {}
def register(attack_type):
if attack_type.base_attack:
if attack_type.base_attack in attacks_listing:
raise Exception("Attack already registered for this base_object_type.")
elif attack_type.name in listing_by_name:
raise Exception(... | attacks_listing = {}
listing_by_name = {}
def register(attack_type):
if attack_type.base_attack:
if attack_type.base_attack in attacks_listing:
raise exception('Attack already registered for this base_object_type.')
elif attack_type.name in listing_by_name:
raise exception('... |
# MIT License
#
# Copyright (c) 2019 Eduardo E. Betanzos Morales
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy,... | class Module:
def __init__(self, name: str, exportsPackages=None, requiresModules=None):
self.__name = name
self.__exports_packages = exportsPackages
self.__requires_modules = requiresModules
@classmethod
def from_json(cls, data):
return cls(**data)
def get_name(self):... |
# Copyright 2014 PDFium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'bigint',
'type': 'static_library',
'sources': [
'bigint/BigInteger.hh',
'bigint/BigInteger... | {'targets': [{'target_name': 'bigint', 'type': 'static_library', 'sources': ['bigint/BigInteger.hh', 'bigint/BigIntegerLibrary.hh', 'bigint/BigIntegerUtils.hh', 'bigint/BigUnsigned.hh', 'bigint/NumberlikeArray.hh', 'bigint/BigUnsignedInABase.hh', 'bigint/BigInteger.cc', 'bigint/BigIntegerUtils.cc', 'bigint/BigUnsigned.... |
CERTIFICATION_SERVICES_TABLE_ID = 'cas'
INTERMEDIATE_CA_TAB_XPATH = '//a[@href="#intermediate_cas_tab"]'
INTERMEDIATE_CA_ADD_BTN_ID = 'intermediate_ca_add'
INTERMEDIATE_CA_CERT_UPLOAD_INPUT_ID = 'ca_cert_file'
INTERMEDIATE_CA_OCSP_TAB_XPATH = '//a[@href="#intermediate_ca_ocsp_responders_tab"]'
INTERMEDIATE_CA_OCSP... | certification_services_table_id = 'cas'
intermediate_ca_tab_xpath = '//a[@href="#intermediate_cas_tab"]'
intermediate_ca_add_btn_id = 'intermediate_ca_add'
intermediate_ca_cert_upload_input_id = 'ca_cert_file'
intermediate_ca_ocsp_tab_xpath = '//a[@href="#intermediate_ca_ocsp_responders_tab"]'
intermediate_ca_ocsp_add_... |
#!/usr/bin/env python3
def max_profit_with_k_transactions(prices, k):
pass
print(max_profit_with_k_transactions([5, 11, 3, 50, 60, 90], 2))
| def max_profit_with_k_transactions(prices, k):
pass
print(max_profit_with_k_transactions([5, 11, 3, 50, 60, 90], 2)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.