content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def ejercicio_1(cadena):
i=0
while cadena[i]== " ":
i+=1
return cadena[i:]
print (ejercicio_1("programacion_1"))
| def ejercicio_1(cadena):
i = 0
while cadena[i] == ' ':
i += 1
return cadena[i:]
print(ejercicio_1('programacion_1')) |
mask, memory, answer = None, {}, 0
for line in open('input.txt', 'r').readlines():
inst, val = line.strip().replace(' ', '').split('=')
if 'mask' in inst:
mask = val
elif 'mem' in inst:
mem_add = '{:036b}'.format(int(inst[4:-1]))
num = '{:036b}'.format(int(val))
masked_num = [mask[i] if mask[i] in ['1', '0']... | (mask, memory, answer) = (None, {}, 0)
for line in open('input.txt', 'r').readlines():
(inst, val) = line.strip().replace(' ', '').split('=')
if 'mask' in inst:
mask = val
elif 'mem' in inst:
mem_add = '{:036b}'.format(int(inst[4:-1]))
num = '{:036b}'.format(int(val))
masked_... |
# Part 1
counter = 0
for line in open('input.txt', 'r').readlines():
# iterate output
for entry in line.split(" | ")[1].split(" "):
entry = entry.strip()
# count trivial numbers
if len(entry) == 2 or len(entry) == 3 or len(entry) == 4 or len(entry) == 7:
counter += 1
print("... | counter = 0
for line in open('input.txt', 'r').readlines():
for entry in line.split(' | ')[1].split(' '):
entry = entry.strip()
if len(entry) == 2 or len(entry) == 3 or len(entry) == 4 or (len(entry) == 7):
counter += 1
print('Part 1', counter)
solution_sum = 0
for line in open('input.tx... |
#coding=utf-8
'''
Created on 2016-10-28
@author: Administrator
'''
class TestException(object):
'''
classdocs
'''
@staticmethod
def exception_1():
raise Exception("fdsfdsfsd")
| """
Created on 2016-10-28
@author: Administrator
"""
class Testexception(object):
"""
classdocs
"""
@staticmethod
def exception_1():
raise exception('fdsfdsfsd') |
class Token:
def __init__(self, token_index_in_sentence, text, pos_tag=None, mate_tools_pos_tag=None, mate_tools_lemma=None,
tree_tagger_lemma=None,
iwnlp_lemma=None, polarity=None, spacy_pos_stts=None, spacy_pos_universal_google=None,
spacy_ner_type=None,
... | class Token:
def __init__(self, token_index_in_sentence, text, pos_tag=None, mate_tools_pos_tag=None, mate_tools_lemma=None, tree_tagger_lemma=None, iwnlp_lemma=None, polarity=None, spacy_pos_stts=None, spacy_pos_universal_google=None, spacy_ner_type=None, spacy_ner_iob=None, spacy_shape=None, spacy_is_punct=None,... |
#OS_MA_NFVO_IP = '192.168.1.219'
OS_MA_NFVO_IP = '192.168.1.197'
OS_USER_DOMAIN_NAME = 'Default'
OS_USERNAME = 'admin'
OS_PASSWORD = '0000'
OS_PROJECT_DOMAIN_NAME = 'Default'
OS_PROJECT_NAME = 'admin'
| os_ma_nfvo_ip = '192.168.1.197'
os_user_domain_name = 'Default'
os_username = 'admin'
os_password = '0000'
os_project_domain_name = 'Default'
os_project_name = 'admin' |
a = int(input())
l1 = []
i=0
temp = 1
print(2^3)
while i<a:
if temp^a==0:
i+=1
else:
l1.append(i)
temp+=1
print(temp)
print(l1)
| a = int(input())
l1 = []
i = 0
temp = 1
print(2 ^ 3)
while i < a:
if temp ^ a == 0:
i += 1
else:
l1.append(i)
temp += 1
print(temp)
print(l1) |
def solve():
ab=input()
ans=ab[0]
ans+="".join(ab[1:-1:2])
ans+=ab[-1]
print(ans)
if __name__ == '__main__':
t=int(input())
for _ in range(t):
solve()
| def solve():
ab = input()
ans = ab[0]
ans += ''.join(ab[1:-1:2])
ans += ab[-1]
print(ans)
if __name__ == '__main__':
t = int(input())
for _ in range(t):
solve() |
def configure(ctx):
ctx.env.has_mpi = False
mpiccpath = ctx.find_program("mpicc")
if mpiccpath:
ctx.env.has_mpi = True
envmpi = ctx.env.copy()
ctx.setenv('mpi', envmpi)
ctx.env.CC = [mpiccpath]
ctx.env.LINK_CC = [mpiccpath]
envmpibld = envmpi = ctx.env.copy()
... | def configure(ctx):
ctx.env.has_mpi = False
mpiccpath = ctx.find_program('mpicc')
if mpiccpath:
ctx.env.has_mpi = True
envmpi = ctx.env.copy()
ctx.setenv('mpi', envmpi)
ctx.env.CC = [mpiccpath]
ctx.env.LINK_CC = [mpiccpath]
envmpibld = envmpi = ctx.env.copy()
... |
# These inheritance models are distinct from the official OMIM models of inheritance for variants
# which are specified by GENETIC_MODELS (in variant_tags.py).
# The following models are used while describing inheritance of genes in gene panels
# It's a custom-compiled list of values
GENE_PANELS_INHERITANCE_MODELS = (
... | gene_panels_inheritance_models = (('AD', 'AD - Autosomal Dominant'), ('AR', 'AR - Autosomal recessive'), ('XL', 'XL - X Linked'), ('XD', 'XD - X Linked Dominant'), ('XR', 'XR - X Linked Recessive'), ('NA', 'NA - not available'), ('AD (imprinting)', 'AD (imprinting) - Autosomal Dominant (imprinting)'), ('digenic', 'dige... |
#
# PySNMP MIB module CABH-PS-DEV-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CABH-PS-DEV-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:26:31 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint) ... |
def spliceOut(self):
if self.isLeaf():
if self.isLeftChild():
self.parent.leftChild = None
else:
self.parent.rightChild = None
elif self.hasAnyChildren():
if self.hasLeftChild():
if self.isLeftChild():
self.parent.leftChild = self.leftC... | def splice_out(self):
if self.isLeaf():
if self.isLeftChild():
self.parent.leftChild = None
else:
self.parent.rightChild = None
elif self.hasAnyChildren():
if self.hasLeftChild():
if self.isLeftChild():
self.parent.leftChild = self.left... |
def string_starts(s, m):
return s[:len(m)] == m
def split_sentence_in_words(s):
return s.split()
def modify_uppercase_phrase(s):
if s == s.upper():
words = split_sentence_in_words( s.lower() )
res = [ w.capitalize() for w in words ]
return ' '.join( res )
else:
return s... | def string_starts(s, m):
return s[:len(m)] == m
def split_sentence_in_words(s):
return s.split()
def modify_uppercase_phrase(s):
if s == s.upper():
words = split_sentence_in_words(s.lower())
res = [w.capitalize() for w in words]
return ' '.join(res)
else:
return s |
string = "3113322113"
for loop in range(50):
output = ""
count = 1
digit = string[0]
for i in range(1, len(string)):
if string[i] == digit:
count += 1
else:
output += str(count) + digit
digit = string[i]
count = 1
output += str(count) + digit
#print(loop, output)
string =... | string = '3113322113'
for loop in range(50):
output = ''
count = 1
digit = string[0]
for i in range(1, len(string)):
if string[i] == digit:
count += 1
else:
output += str(count) + digit
digit = string[i]
count = 1
output += str(count) +... |
class PoolRaidLevels(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_pool_raid_levels(idx_name)
class PoolRaidLevelsColumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_pools()
| class Poolraidlevels(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_pool_raid_levels(idx_name)
class Poolraidlevelscolumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_pools() |
# Python3 program to find Intersection of two
# Sorted Arrays (Handling Duplicates)
def IntersectionArray(a, b, n, m):
'''
:param a: given sorted array a
:param n: size of sorted array a
:param b: given sorted array b
:param m: size of sorted array b
:return: array of intersection of two array o... | def intersection_array(a, b, n, m):
"""
:param a: given sorted array a
:param n: size of sorted array a
:param b: given sorted array b
:param m: size of sorted array b
:return: array of intersection of two array or -1
"""
intersection = []
i = j = 0
while i < n and j < m:
... |
class Config:
epochs = 50
batch_size = 8
learning_rate_decay_epochs = 10
# save model
save_frequency = 5
save_model_dir = "saved_model/"
load_weights_before_training = False
load_weights_from_epoch = 0
# test image
test_single_image_dir = ""
test_images_during_training = F... | class Config:
epochs = 50
batch_size = 8
learning_rate_decay_epochs = 10
save_frequency = 5
save_model_dir = 'saved_model/'
load_weights_before_training = False
load_weights_from_epoch = 0
test_single_image_dir = ''
test_images_during_training = False
training_results_save_dir = ... |
class Polygon():
def __init__(self, no_of_sides):
self.n = no_of_sides
self.sides = [0 for i in range (no_of_sides)]
def inputSides(self):
self.sides = [float(input('Enter side '+str(i+1)+' : ')) for i in range(self.n)]
def dispSides(self):
for i in range(self.n):
... | class Polygon:
def __init__(self, no_of_sides):
self.n = no_of_sides
self.sides = [0 for i in range(no_of_sides)]
def input_sides(self):
self.sides = [float(input('Enter side ' + str(i + 1) + ' : ')) for i in range(self.n)]
def disp_sides(self):
for i in range(self.n):
... |
class DaiquiriException(Exception):
def __init__(self, errors):
self.errors = errors
def __str__(self):
return repr(self.errors)
| class Daiquiriexception(Exception):
def __init__(self, errors):
self.errors = errors
def __str__(self):
return repr(self.errors) |
# Do not edit this file directly.
# It was auto-generated by: code/programs/reflexivity/reflexive_refresh
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def glib():
http_archive(
name="glib" ,
build_file="//bazel/deps/glib:build.BUILD" ,
sha256="80753e02bd0baddfa0380... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def glib():
http_archive(name='glib', build_file='//bazel/deps/glib:build.BUILD', sha256='80753e02bd0baddfa03807dccc6da4e063f272026f07fd0e05e17c6e5353b07e', strip_prefix='glib-2ba0f14b5298f49dcc3b376d2bdf6505b2c32bd3', urls=['https://github.com/U... |
# QI = {"AGE": 1, "SEX": 1, "CURADM_DAYS": 1, "OUTCOME": 0, "CURRICU_FLAG":0,
# "PREVADM_NO":0, "PREVADM_DAYS":0, "PREVICU_DAYS":0, "READMISSION_30_DAYS":0}
# K = 20
CATEGORICAL_ATTRIBUTES = {"AGE": 0, "SEX": 1, "CURADM_DAYS": 0, "OUTCOME": 1, "CURRICU_FLAG":1,
"PREVADM_NO":0, "PREV... | categorical_attributes = {'AGE': 0, 'SEX': 1, 'CURADM_DAYS': 0, 'OUTCOME': 1, 'CURRICU_FLAG': 1, 'PREVADM_NO': 0, 'PREVADM_DAYS': 0, 'PREVICU_DAYS': 0, 'READMISSION_30_DAYS': 1}
input_directory = '/home/arianna/CSL Docs/Papers/Paper_Anonymized_ML/dataset'
result_directory = f'/home/arianna/CSL Docs/Papers/Paper_Anonymi... |
_base_ = [
'../../_base_/models/retinanet_r50_fpn.py',
'../../_base_/datasets/dota_detection_v2.0_hbb.py',
'../../_base_/schedules/schedule_2x.py', '../../_base_/default_runtime.py'
]
model = dict(
bbox_head=dict(
num_classes=18,
)
)
optimizer =dict(lr=0.01)
work_dir = './work_d... | _base_ = ['../../_base_/models/retinanet_r50_fpn.py', '../../_base_/datasets/dota_detection_v2.0_hbb.py', '../../_base_/schedules/schedule_2x.py', '../../_base_/default_runtime.py']
model = dict(bbox_head=dict(num_classes=18))
optimizer = dict(lr=0.01)
work_dir = './work_dirs/retinanet_r50_fpn_1x_dota' |
#
# PySNMP MIB module ALCATEL-IND1-TIMETRA-SAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-TIMETRA-SAP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:04:02 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python vers... | (t_filter_id,) = mibBuilder.importSymbols('ALCATEL-IND1-TIMETRA-FILTER-MIB', 'TFilterID')
(timetra_srmib_modules,) = mibBuilder.importSymbols('ALCATEL-IND1-TIMETRA-GLOBAL-MIB', 'timetraSRMIBModules')
(t_burst_percent_or_default, t_virtual_scheduler_name, t_scheduler_policy_name, t_burst_size, t_adaptation_rule) = mibBu... |
class Product:
def doStuff(self): pass
def foo(product):
product.doStuff() | class Product:
def do_stuff(self):
pass
def foo(product):
product.doStuff() |
'''input
-1 -1 1 1
'''
a = list(map(int, input().split()))
print(abs(a[2]-a[0]) + abs(a[3]-a[1]))
| """input
-1 -1 1 1
"""
a = list(map(int, input().split()))
print(abs(a[2] - a[0]) + abs(a[3] - a[1])) |
def histogram(s):
d = dict()
for c in s:
d[c] = d.get(c, s.count(c))
return d
def invert_dict(d):
inverse = dict()
for key in d:
value = d[key]
inverse.setdefault(value, [])
inverse[value].append(key)
return inverse
h = histogram('brontosaurus')
print(invert_dic... | def histogram(s):
d = dict()
for c in s:
d[c] = d.get(c, s.count(c))
return d
def invert_dict(d):
inverse = dict()
for key in d:
value = d[key]
inverse.setdefault(value, [])
inverse[value].append(key)
return inverse
h = histogram('brontosaurus')
print(invert_dict... |
# CPU: 0.06 s
line = input()
length = len(line)
upper_count = 0
lower_count = 0
whitespace_count = 0
symbol_count = 0
for char in line:
if char == "_":
whitespace_count += 1
elif 97 <= ord(char) <= 122:
lower_count += 1
elif 65 <= ord(char) <= 90:
upper_count += 1
else:
... | line = input()
length = len(line)
upper_count = 0
lower_count = 0
whitespace_count = 0
symbol_count = 0
for char in line:
if char == '_':
whitespace_count += 1
elif 97 <= ord(char) <= 122:
lower_count += 1
elif 65 <= ord(char) <= 90:
upper_count += 1
else:
symbol_count +=... |
# Test Program
# This program prints "Hello World!" to Standard Output
print('Hello World!')
| print('Hello World!') |
# http://www.practicepython.org/exercise/2014/02/15/03-list-less-than-ten.html
# 3 listLessThanTen.py
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
for i in a:
if i < 5:
print(i)
print('')
# Extra 1
b = []
for i in a:
if i < 5:
b.append(i)
print(b)
print('')
# Extra 2
print([x for x in a if ... | a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
for i in a:
if i < 5:
print(i)
print('')
b = []
for i in a:
if i < 5:
b.append(i)
print(b)
print('')
print([x for x in a if x < 5])
print('')
num = input('Give me a number: ')
print('These are the numbers smaller than ' + num + ': ' + str([x for x in a ... |
MAINNET_PORT = 18981
TESTNET_PORT = 28981
LOCAL_ADDRESS = "127.0.0.1"
LOCAL_DAEMON_ADDRESS_MAINNET = "{}:{}".format(LOCAL_ADDRESS, MAINNET_PORT)
LOCAL_DAEMON_ADDRESS_TESTNET = "{}:{}".format(LOCAL_ADDRESS, TESTNET_PORT)
DAEMON_RPC_URL = "http://{}/json_rpc"
| mainnet_port = 18981
testnet_port = 28981
local_address = '127.0.0.1'
local_daemon_address_mainnet = '{}:{}'.format(LOCAL_ADDRESS, MAINNET_PORT)
local_daemon_address_testnet = '{}:{}'.format(LOCAL_ADDRESS, TESTNET_PORT)
daemon_rpc_url = 'http://{}/json_rpc' |
def main():
compute_deeper_readings('src/december01/depths.txt')
def compute_deeper_readings(readings):
deeper_readings = 0
previous_depth = 0
with open(readings, 'r') as depths:
for depth in depths:
if int(depth) > previous_depth:
deeper_readings += 1
... | def main():
compute_deeper_readings('src/december01/depths.txt')
def compute_deeper_readings(readings):
deeper_readings = 0
previous_depth = 0
with open(readings, 'r') as depths:
for depth in depths:
if int(depth) > previous_depth:
deeper_readings += 1
pr... |
## https://leetcode.com/problems/unique-email-addresses/
## goal is to find the number of unique email addresses, given
## some rules for simplifying a given email address.
## solution is to write a function to sanitize a single
## email address, then map it over the inputs, then return
## the size of a set of th... | class Solution:
def sanitize_email_address(self, email: str) -> str:
(user, domain) = email.split('@')
user = user.split('+')[0]
user = user.replace('.', '')
return user + '@' + domain
def num_unique_emails(self, emails: List[str]) -> int:
cleaned_emails = map(self.sani... |
i = 0
while i == 0:
file1 = open('APPMAKE', 'r')
Lines = file1.readlines()
count = 0
checkpoint = 0
ccount = 1
# Strips the newline character
for line in Lines:
count += 1
ccount += 1
modeset += 1
if ccount > checkpoint:
checkpoint += 1
if modeset > 2:
... | i = 0
while i == 0:
file1 = open('APPMAKE', 'r')
lines = file1.readlines()
count = 0
checkpoint = 0
ccount = 1
for line in Lines:
count += 1
ccount += 1
modeset += 1
if ccount > checkpoint:
checkpoint += 1
if modeset > 2:
mo... |
def main():
with open("input.txt") as f:
nums = [int(line) for line in f.readlines()]
for num in nums:
for num2 in nums:
if num + num2 == 2020:
print(num * num2)
exit(0)
exit(1)
if __name__ == "__main__":
main()
| def main():
with open('input.txt') as f:
nums = [int(line) for line in f.readlines()]
for num in nums:
for num2 in nums:
if num + num2 == 2020:
print(num * num2)
exit(0)
exit(1)
if __name__ == '__main__':
main() |
#
# PySNMP MIB module HP-ICF-BYOD-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-BYOD-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:33:32 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_intersection, constraints_union, single_value_constraint) ... |
# 3. Repeat String
# Write a function that receives a string and a repeat count n.
# The function should return a new string (the old one repeated n times).
def repeat_string(string, repeat_times):
return string * repeat_times
text = input()
n = int(input())
result = repeat_string(text, n)
print(result)
| def repeat_string(string, repeat_times):
return string * repeat_times
text = input()
n = int(input())
result = repeat_string(text, n)
print(result) |
class Interval:
# interval is [left, right]
# note that endpoints are included
def __init__(self, left, right):
self.left = left
self.right = right
def getLeftEndpoint(self):
return self.left
def getRightEndpoint(self):
return self.right
def isEqualTo(self, i):
... | class Interval:
def __init__(self, left, right):
self.left = left
self.right = right
def get_left_endpoint(self):
return self.left
def get_right_endpoint(self):
return self.right
def is_equal_to(self, i):
left_endpoints_match = self.getLeftEndpoint() == i.getL... |
#!/usr/bin/env python
if __name__ == "__main__":
with open("input") as fh:
data = fh.readlines()
two_letters = 0
three_letters = 0
for d in data:
counts = {}
for char in d:
if char not in counts:
counts[char] = 0
counts[char] += 1
if 2 in counts.values():
two_letter... | if __name__ == '__main__':
with open('input') as fh:
data = fh.readlines()
two_letters = 0
three_letters = 0
for d in data:
counts = {}
for char in d:
if char not in counts:
counts[char] = 0
counts[char] += 1
if 2 in counts.values()... |
# encoding: utf-8
# module win32uiole
# from C:\Python27\lib\site-packages\Pythonwin\win32uiole.pyd
# by generator 1.147
# no doc
# no imports
# Variables with simple values
COleClientItem_activeState = 3
COleClientItem_activeUIState = 4
COleClientItem_emptyState = 0
COleClientItem_loadedState = 1
COleClientItem_open... | c_ole_client_item_active_state = 3
c_ole_client_item_active_ui_state = 4
c_ole_client_item_empty_state = 0
c_ole_client_item_loaded_state = 1
c_ole_client_item_open_state = 2
ole_changed = 0
ole_changed_aspect = 5
ole_changed_state = 4
ole_closed = 2
ole_renamed = 3
ole_saved = 1
def afx_ole_init(*args, **kwargs):
... |
#
# PySNMP MIB module H3C-VOSIP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-VOSIP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:11:30 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, value_range_constraint, single_value_constraint, constraints_union) ... |
{
"targets": [
{
"target_name": "cpp_mail",
"sources": [
"src/cpp/dkim.cpp",
"src/cpp/model.cpp",
"src/cpp/smtp.cpp",
"src/cpp/main.cpp",
],
'cflags_cc': [ '-fexceptions -g' ],
'cflags': [ '-fexceptions -g' ],
"ldflags": ["-z,defs"],
'var... | {'targets': [{'target_name': 'cpp_mail', 'sources': ['src/cpp/dkim.cpp', 'src/cpp/model.cpp', 'src/cpp/smtp.cpp', 'src/cpp/main.cpp'], 'cflags_cc': ['-fexceptions -g'], 'cflags': ['-fexceptions -g'], 'ldflags': ['-z,defs'], 'variables': {'node_shared_openssl%': 'true'}, 'conditions': [['node_shared_openssl=="false"', {... |
def binPack(i, array, target, dp):
if (i == len(array)):
return(0)
if (i not in dp):
dp[i] = {}
if (target not in dp[i]):
best = binPack(i + 1, array, target, dp)
if (target - array[i] >= 0):
aux = binPack(i + 1, array, target - array[i], dp) + array[i]
... | def bin_pack(i, array, target, dp):
if i == len(array):
return 0
if i not in dp:
dp[i] = {}
if target not in dp[i]:
best = bin_pack(i + 1, array, target, dp)
if target - array[i] >= 0:
aux = bin_pack(i + 1, array, target - array[i], dp) + array[i]
if a... |
if __name__ == '__main__':
Str1 = '14:59~15:20'
StrList = Str1.split('~')
print(StrList)
print(StrList[0])
print(StrList[1])
| if __name__ == '__main__':
str1 = '14:59~15:20'
str_list = Str1.split('~')
print(StrList)
print(StrList[0])
print(StrList[1]) |
# Copyright (C) 2011 MetaBrainz Foundation
# Distributed under the MIT license, see the LICENSE file for details.
__version__ = "0.1.0"
| __version__ = '0.1.0' |
#App
HOST = '0.0.0.0'
PORT = 6000
DEBUG = False
#AWS
BUCKET = 'fastermlpipeline'
ACCESS_KEY = 'sorry_itsasecret'
SECRET_KEY = 'sure_itsasecret'
#Extract Data
URL_DATA = 'http://api:5000/credits'
#Preprocessors
NUMERICAL_FEATURES = ['age', 'job', 'credit_amount' ,'duration']
CATEGORICAL_FEATURES = ['sex', 'housing... | host = '0.0.0.0'
port = 6000
debug = False
bucket = 'fastermlpipeline'
access_key = 'sorry_itsasecret'
secret_key = 'sure_itsasecret'
url_data = 'http://api:5000/credits'
numerical_features = ['age', 'job', 'credit_amount', 'duration']
categorical_features = ['sex', 'housing', 'saving_accounts', 'checking_account', 'pu... |
lookup_table = {
"TRI_FACILITY_NPDES": {
"ASGN_NPDES_IND": "Indicates that the associated NPDES_NUM represents the principal NPDES permit number as assigned to the facility by TRI from Form R or Form A submissions. Values: 1 = 'Yes', 0 = 'No'.",
"TRI_FACILITY_ID": "The unique number assigned to each facilit... | lookup_table = {'TRI_FACILITY_NPDES': {'ASGN_NPDES_IND': "Indicates that the associated NPDES_NUM represents the principal NPDES permit number as assigned to the facility by TRI from Form R or Form A submissions. Values: 1 = 'Yes', 0 = 'No'.", 'TRI_FACILITY_ID': 'The unique number assigned to each facility for purpose... |
#Write a function that takes a two-dimensional list (list of lists) of numbers as argument and returns a list
#which includes the sum of each row. You can assume that the number of columns in each row is the same.
def sum_of_two_lists_row(list2d):
final_list = []
for list_numbers in list2d:
sum_list = 0
for nu... | def sum_of_two_lists_row(list2d):
final_list = []
for list_numbers in list2d:
sum_list = 0
for number in list_numbers:
sum_list += number
final_list.append(sum_list)
return final_list
print(sum_of_two_lists([[1, 2], [3, 4]])) |
def count_words(input_str):
return len(input_str.split())
print(count_words('this is a string'))
demo_str = 'hellow world'
print(count_words(demo_str))
def find_min(num_list):
min_item = num_list[0]
for num in num_list:
if type(num) is not str:
if min_item>... | def count_words(input_str):
return len(input_str.split())
print(count_words('this is a string'))
demo_str = 'hellow world'
print(count_words(demo_str))
def find_min(num_list):
min_item = num_list[0]
for num in num_list:
if type(num) is not str:
if min_item >= num:
min_it... |
def find_minimum_number_of_moves(rows, cols, start_row, start_col, end_row, end_col):
# row_low = start_row if start_row < end_row else end_row
# row_high = start_row if start_row > end_row else end_row
# col_low = start_col if start_col < end_col else end_col
# col_high = start_col if start_col > end_c... | def find_minimum_number_of_moves(rows, cols, start_row, start_col, end_row, end_col):
deltas = [(-2, -1), (-2, +1), (+2, -1), (+2, +1), (-1, -2), (-1, +2), (+1, -2), (+1, +2)]
def get_all_valid_moves(y0, x0):
valid_positions = []
for (x, y) in deltas:
x_candidate = x0 + x
... |
#
# subtag.py
# =========
#
# Python-3 module for loading and parsing the Language Subtag Registry
# from IANA.
#
# A current copy of the registry can be downloaded from IANA at the
# following address:
#
# https://www.iana.org/assignments/
# language-subtag-registry/language-subtag-registry
#
# The format of this ... | class Subtagerror(Exception):
def __str__(self):
return 'Unknown subtag parsing error!'
class Badcontinueline(SubtagError):
def __init__(self, line=None):
self.m_line = line
def __str__(self):
if self.m_line is not None:
return 'Subtag data line ' + str(self.m_line) +... |
for _ in range(int(input())):
p,n=input(),int(input())
x=input()[1:-1].split(',')
pos,rpos,mode=0,n-1,0
error=False
for i in p:
if i=='R': mode=(mode+1)%2
else:
if pos>rpos:
print('error')
error=True
break
if mode==0: pos+=1
else: rpos-=1
if error: continue
print(end='[')
if mode==0:
... | for _ in range(int(input())):
(p, n) = (input(), int(input()))
x = input()[1:-1].split(',')
(pos, rpos, mode) = (0, n - 1, 0)
error = False
for i in p:
if i == 'R':
mode = (mode + 1) % 2
else:
if pos > rpos:
print('error')
error... |
# -*- coding: utf-8 -*-
# @Author: davidhansonc
# @Date: 2021-01-19 10:22:34
# @Last Modified by: davidhansonc
# @Last Modified time: 2021-01-19 10:56:52
my_string = 'abcde fgh'
def reverse_string(string):
rev_str = ''
for i in range(len(string)-1, -1, -1):
rev_str += string[i]
return rev_str
... | my_string = 'abcde fgh'
def reverse_string(string):
rev_str = ''
for i in range(len(string) - 1, -1, -1):
rev_str += string[i]
return rev_str
def reverse_string2(string):
return string[::-1]
print(reverse_string(my_string))
print(reverse_string2(my_string)) |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def middleNode(self, head: ListNode) -> ListNode:
d = 1
current = head.next
middle = head
while current:
d +=... | class Solution:
def middle_node(self, head: ListNode) -> ListNode:
d = 1
current = head.next
middle = head
while current:
d += 1
if d % 2 == 0:
middle = middle.next
current = current.next
return middle |
name = 'Sina'
last = 'Bakhshandeh'
age = 29
nationality = 'Iran'
a = 'I am Sina Bakhshandeh 29 years old, from iran.'
# print(a)
# print('I am', name, last, age ,'years old, from ', nationality)
b = 'I am {} {} {} years old, from {}.'
print( b.format(name, last, age, nationality) ) | name = 'Sina'
last = 'Bakhshandeh'
age = 29
nationality = 'Iran'
a = 'I am Sina Bakhshandeh 29 years old, from iran.'
b = 'I am {} {} {} years old, from {}.'
print(b.format(name, last, age, nationality)) |
#!usr/bin/python3
with open('01/input.txt', 'r') as file:
increases = 0
previous = file.readline()
for line in file.readlines():
delta = int(line) - int(previous)
if delta > 0:
increases += 1
previous = line
print(increases) | with open('01/input.txt', 'r') as file:
increases = 0
previous = file.readline()
for line in file.readlines():
delta = int(line) - int(previous)
if delta > 0:
increases += 1
previous = line
print(increases) |
# Basics
5 == 5 # True
5 == 4 # False
5 != 4 # True
5 > 3 # True
3 < 5 # True
5 >= 3 # True
5 >= 5 # True
[1, 2, 4] > [1, 2, 3] # True
1 < 2 and 5 > 4 # True
(1 < 2) and (5 > 4) # True
1 > 2 or 5 > 4 # True
#Chainging
x = 4
x > 3 and x < 5 # True
3 < x < 5 # True
# isinstance
isinstance("Will", str) # True
isinstance... | 5 == 5
5 == 4
5 != 4
5 > 3
3 < 5
5 >= 3
5 >= 5
[1, 2, 4] > [1, 2, 3]
1 < 2 and 5 > 4
1 < 2 and 5 > 4
1 > 2 or 5 > 4
x = 4
x > 3 and x < 5
3 < x < 5
isinstance('Will', str)
isinstance('Will', int)
isinstance(4.0, float)
a = True
b = True
a is b
x = [1, 2, 3]
y = [1, 2, 3]
x is y
x = [1, 2, 3]
3 in x
5 in x
x = [1, 2, 3]... |
# Region
# VPC
# Private Subnet
# Public Subnet
# Security Group
# Availability Zone
# AWS Step Functions Workflow
# Elastic Beanstalk container
# Auto Scaling Group
# Server contents
# EC2 instance contents
# Spot Fleet
groups = {
'AWS::AccountId': {'level': 0},
'AWS::Region': {'level': 1},
'AWS::IAM:... | groups = {'AWS::AccountId': {'level': 0}, 'AWS::Region': {'level': 1}, 'AWS::IAM::': {'level': 2}, 'AWS::EC2::VPC': {'level': 3}, 'AvailabilityZone': {'level': 4}, 'AWS::EC2::SecurityGroup': {'level': 4}, 'AWS::EC2::Subnet': {'level': 5}, 'Default': {'level': 6}}
blacklist_resource_types = ['AWS::SSM::Parameter', 'AWS:... |
f = open('latin_text', 'w')
for i in xrange(5000):
text = "Lorem ipsum dolor sit amet, est malis molestiae no,\nrebum" \
"mediocrem vituperatoribus qui et. Quando intellegam ne mea," \
" utroque\n voluptua sensibus nam te. In duo accusam accusamus," \
" mea ad iriure detracto\nsigni... | f = open('latin_text', 'w')
for i in xrange(5000):
text = 'Lorem ipsum dolor sit amet, est malis molestiae no,\nrebummediocrem vituperatoribus qui et. Quando intellegam ne mea, utroque\n voluptua sensibus nam te. In duo accusam accusamus, mea ad iriure detracto\nsigniferumque. Veri complectitur concludaturque te se... |
def multi_inverse(b, n):
r1 = n
r2 = b
t1 = 0
t2 = 1
while(r1 > 0):
q = int(r1/r2)
r = r1 - q * r2
r1 = r2
r2 = r
t = t1 - q * t2
t1 = t2
t2 = t
if(r1 == 1):
inv_t = t1
break
return inv_t
| def multi_inverse(b, n):
r1 = n
r2 = b
t1 = 0
t2 = 1
while r1 > 0:
q = int(r1 / r2)
r = r1 - q * r2
r1 = r2
r2 = r
t = t1 - q * t2
t1 = t2
t2 = t
if r1 == 1:
inv_t = t1
break
return inv_t |
#Data : 2018-10-15
#Author : Fengyuan Zhang (Franklin)
#Email : franklinzhang@foxmail.com
class ModelDataHandler:
def __init__(self, context):
self.mContext = context
self.mExecutionPath = ''
self.mZipExecutionPath = ''
self.mExecutionName = ''
self.mSavePath = ''
... | class Modeldatahandler:
def __init__(self, context):
self.mContext = context
self.mExecutionPath = ''
self.mZipExecutionPath = ''
self.mExecutionName = ''
self.mSavePath = ''
self.mSaveName = ''
self.mReturnFileFullName = ''
def connect_data_mapping_meth... |
class Solution:
def trap(self, height: List[int]) -> int:
if len(height) < 3:
return 0
max_left = [0] * len(height)
max_right = [0] * len(height)
for i in range(1, len(height)):
max_left[i] = max(height[i - 1], max_left[i - 1])
for i in ra... | class Solution:
def trap(self, height: List[int]) -> int:
if len(height) < 3:
return 0
max_left = [0] * len(height)
max_right = [0] * len(height)
for i in range(1, len(height)):
max_left[i] = max(height[i - 1], max_left[i - 1])
for i in range(len(heig... |
__version__ = "0.2.2"
__license__ = "MIT License"
__website__ = "https://code.exrny.com/opensource/vulcan-builder/"
__download_url__ = ('https://github.com/exrny/vulcan-builder/archive/'
'{}.tar.gz'.format(__version__))
| __version__ = '0.2.2'
__license__ = 'MIT License'
__website__ = 'https://code.exrny.com/opensource/vulcan-builder/'
__download_url__ = 'https://github.com/exrny/vulcan-builder/archive/{}.tar.gz'.format(__version__) |
'''
Created on Mar 27, 2015
@author: maxz
'''
def lim(x, perc=.1):
r = x.max() - x.min()
return x.min()-perc*r, x.max()+perc*r
| """
Created on Mar 27, 2015
@author: maxz
"""
def lim(x, perc=0.1):
r = x.max() - x.min()
return (x.min() - perc * r, x.max() + perc * r) |
# Copyright 2019 The go-python Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# Benchmark adapted from https://github.com/d5/tengobench/
doc="fib tail call recursion test"
def fib(n, a, b):
if n == 0:
return a
elif n ... | doc = 'fib tail call recursion test'
def fib(n, a, b):
if n == 0:
return a
elif n == 1:
return b
return fib(n - 1, b, a + b)
fib(35, 0, 1)
doc = 'finished' |
class ParsingError(Exception):
pass
| class Parsingerror(Exception):
pass |
load("@bazelruby_rules_ruby//ruby:defs.bzl", "ruby_test")
# `dir` is path from WORKSPACE root.
def steep_check(name, bin, srcs, deps, dir = ".", rubyopt = []):
ruby_test(
name = name,
srcs = srcs,
deps = deps,
main = bin,
args = [
"check",
"--steepfile={}/Steepfile".format(dir),
... | load('@bazelruby_rules_ruby//ruby:defs.bzl', 'ruby_test')
def steep_check(name, bin, srcs, deps, dir='.', rubyopt=[]):
ruby_test(name=name, srcs=srcs, deps=deps, main=bin, args=['check', '--steepfile={}/Steepfile'.format(dir), '--steep-command={}/{}'.format(dir, name)], rubyopt=rubyopt) |
class Location:
pass
class DecimalLocation:
pass
class GridLocation:
pass
| class Location:
pass
class Decimallocation:
pass
class Gridlocation:
pass |
def make_complex1(*args):
x, y = args
return dict(**locals())
def make_complex2(x, y):
return {'x': x, 'y': y}
print(make_complex1(5, 6))
print(make_complex2(5, 6))
| def make_complex1(*args):
(x, y) = args
return dict(**locals())
def make_complex2(x, y):
return {'x': x, 'y': y}
print(make_complex1(5, 6))
print(make_complex2(5, 6)) |
if __name__ == '__main__':
def uninit_switch(*args):
raise TypeError("executed a case stmt outside switch's context")
class switch:
@property
def default(self):
if self.finished:
raise SyntaxError("multiple 'default' cases were provided")
self.fi... | if __name__ == '__main__':
def uninit_switch(*args):
raise type_error("executed a case stmt outside switch's context")
class Switch:
@property
def default(self):
if self.finished:
raise syntax_error("multiple 'default' cases were provided")
self... |
stamina = 6
alive=False
def report(stamina):
if stamina > 8:
print ("The alien is strong! It resists your pathetic attack!")
elif stamina > 5:
print ("With a loud grunt, the alien stands firm.")
elif stamina > 3:
print ("Your attack seems to be having an effect! The alien stu... | stamina = 6
alive = False
def report(stamina):
if stamina > 8:
print('The alien is strong! It resists your pathetic attack!')
elif stamina > 5:
print('With a loud grunt, the alien stands firm.')
elif stamina > 3:
print('Your attack seems to be having an effect! The alien stumbles!')... |
class EpisodeQuality:
def __init__(self, title: str, url: str):
self.title = title
self.url = url
| class Episodequality:
def __init__(self, title: str, url: str):
self.title = title
self.url = url |
#
# PySNMP MIB module APSLB-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/APSLB-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:24:22 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... | (acmepacket_mgmt,) = mibBuilder.importSymbols('ACMEPACKET-SMI', 'acmepacketMgmt')
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraint... |
#i'm an idiot, this algoritm is fucking useless, the FB and LR notation is literally binary notation.
def ticketCheck(line):
rowMin = 0
rowMax = 127
colMin = 0
colMax = 7
for i in range (7):
if line[i] == 'F':
rowMax = rowMin + abs(int((rowMax - rowMin)/2))
else: rowMin ... | def ticket_check(line):
row_min = 0
row_max = 127
col_min = 0
col_max = 7
for i in range(7):
if line[i] == 'F':
row_max = rowMin + abs(int((rowMax - rowMin) / 2))
else:
row_min = rowMax - abs(int((rowMax - rowMin) / 2))
for i in range(3):
if line[7... |
list = [50,100,150,200,250,300]
mininumber = list[0]
for x in list:
if mininumber > x:
mininumber = x
print("mininumber is ",mininumber)
| list = [50, 100, 150, 200, 250, 300]
mininumber = list[0]
for x in list:
if mininumber > x:
mininumber = x
print('mininumber is ', mininumber) |
# File: config.py
# Author: Qian Ge <geqian1001@gmail.com>
# directory of pre-trained vgg parameters
vgg_dir = '../../data/pretrain/vgg/vgg19.npy'
# directory of training data
data_dir = '../../data/dataset/256_ObjectCategories/'
# directory of testing data
test_data_dir = '../data/'
# directory of infe... | vgg_dir = '../../data/pretrain/vgg/vgg19.npy'
data_dir = '../../data/dataset/256_ObjectCategories/'
test_data_dir = '../data/'
infer_data_dir = '../data/'
infer_dir = '../../data/tmp/'
summary_dir = '../../data/tmp/'
checkpoint_dir = '../../data/tmp/'
model_dir = '../../data/tmp/'
result_dir = '../../data/tmp/' |
# Solution 1
# O(n^2) time | O(n) space
def longestIncreasingSubsequence(array):
if len(array) <= 1:
return array
sequences = [None for _ in range(len(array))]
lengths = [1 for _ in range(len(array))]
maxLenIdx = 0
for i in range(len(array)):
curNum = array[i]
for j in ra... | def longest_increasing_subsequence(array):
if len(array) <= 1:
return array
sequences = [None for _ in range(len(array))]
lengths = [1 for _ in range(len(array))]
max_len_idx = 0
for i in range(len(array)):
cur_num = array[i]
for j in range(i):
other_num = array[j... |
class Auth:
class general:
token = None # Token for general authentication
class live:
result = None # JSON result of the Live Auth request;
class Me(object):
def __init__(self):
self.id = None
self.username = None
self.auth = Auth
cl... | class Auth:
class General:
token = None
class Live:
result = None
class Me(object):
def __init__(self):
self.id = None
self.username = None
self.auth = Auth
class Http_Request:
class Login:
uri = 'https://social.triller.co/v1.5/user/auth'
hea... |
# MIT License
#
# Copyright (c) 2020 Evgeny Medvedev, evge.medvedev@gmail.com
#
# 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
# ... | class Attesterslashing(object):
def __init__(self):
self.attestation_1_attesting_indices = []
self.attestation_1_slot = None
self.attestation_1_index = None
self.attestation_1_beacon_block_root = None
self.attestation_1_source_epoch = None
self.attestation_1_source_r... |
def pytrades():
pass
def DiffEvol():
pass
def PyPolyChord():
pass
def PolyChord():
pass
def celerite():
pass
def ttvfast():
pass
def george():
pass
def batman():
pass
def dynesty():
pass
## absurd workaround to fix the lack of celerite in the system
def Celerite_QuasiPeriodi... | def pytrades():
pass
def diff_evol():
pass
def py_poly_chord():
pass
def poly_chord():
pass
def celerite():
pass
def ttvfast():
pass
def george():
pass
def batman():
pass
def dynesty():
pass
def celerite__quasi_periodic_activity():
pass
class Dummy_One:
def __init_... |
NO_ROLE_CODE = ''
TRUSTEE_CODE = '0'
STEWARD_CODE = '2'
TGB_CODE = '100'
TRUST_ANCHOR_CODE = '101'
| no_role_code = ''
trustee_code = '0'
steward_code = '2'
tgb_code = '100'
trust_anchor_code = '101' |
class PartialCumulativeClass:
'''
the concept:
'''
def __init__(self, conf, shared):
self.conf = conf
self.shared = shared
self.sharedAnalysis = None
# define data source / destination
# define data source / destination
self.dataSourceFilePath = ''
... | class Partialcumulativeclass:
"""
the concept:
"""
def __init__(self, conf, shared):
self.conf = conf
self.shared = shared
self.sharedAnalysis = None
self.dataSourceFilePath = ''
self.dataSourceFileName = ''
self.saveAnomaliesFilePath = self.conf.transac... |
'''
You are given an integer array nums sorted in non-decreasing order.
Build and return an integer array result with the same length as
nums such that result[i] is equal to the summation of absolute
differences between nums[i] and all the other elements in the
array.
In other words, result[i] is equal to sum(|num... | """
You are given an integer array nums sorted in non-decreasing order.
Build and return an integer array result with the same length as
nums such that result[i] is equal to the summation of absolute
differences between nums[i] and all the other elements in the
array.
In other words, result[i] is equal to sum(|num... |
#Servo test
e1 = Entry(root)
e1.grid(row=0, column=1)
def cal():
global dc
deg = abs(float(deg1))
dc = 0.056*deg + 2.5
p.ChangeDutyCycle(dc)
print(deg, dc) | e1 = entry(root)
e1.grid(row=0, column=1)
def cal():
global dc
deg = abs(float(deg1))
dc = 0.056 * deg + 2.5
p.ChangeDutyCycle(dc)
print(deg, dc) |
# Weight converter
weight = float(input("Weight?"))
unit = input("(L)bs or (K)g?")
if unit.upper() == "K":
print(weight*2.2)
elif unit.upper() == "L":
print(weight*0.45)
else:
print("Error, please verify your input") | weight = float(input('Weight?'))
unit = input('(L)bs or (K)g?')
if unit.upper() == 'K':
print(weight * 2.2)
elif unit.upper() == 'L':
print(weight * 0.45)
else:
print('Error, please verify your input') |
def stair_ways(n):
ways = [0] * n
ways[0] = 1
if n > 1:
ways[1] = 1
if n > 2:
ways[2] = 1
for p in range(0, n):
if p + 1 < n:
ways[p+1] += ways[p]
if p + 2 < n:
ways[p+2] += ways[p]
if p + 3 < n:
... | def stair_ways(n):
ways = [0] * n
ways[0] = 1
if n > 1:
ways[1] = 1
if n > 2:
ways[2] = 1
for p in range(0, n):
if p + 1 < n:
ways[p + 1] += ways[p]
if p + 2 < n:
ways[p + 2] += ways[p]
if p + 3 < n:
ways[p + 3] += ways[p]
... |
#!/usr/bin/env python
a = 0
b = 1
while b < 100:
print(b)
a,b = b,a+b
| a = 0
b = 1
while b < 100:
print(b)
(a, b) = (b, a + b) |
class state:
def __init__(self, name, population, area, capital):
self.name = name
self.population = population
self.area = area
self.capital = capital
def calc_density(self):
return self.area/self.population
state_1 = state('guj', 50000000, 40000000, 'gandhinagar')
sta... | class State:
def __init__(self, name, population, area, capital):
self.name = name
self.population = population
self.area = area
self.capital = capital
def calc_density(self):
return self.area / self.population
state_1 = state('guj', 50000000, 40000000, 'gandhinagar')
s... |
puffRstring = '''
impute_zeros <- function(x, y, bw){
k <- ksmooth(x=x, y=y, bandwidth=bw)
y[y == 0] <- k$y[y == 0]
return(y)
}
mednorm <- function(x){x/median(x)}
mednorm.ksmooth <-function(x,y,bw){mednorm(ksmooth(x=x,y=y,bandwidth = bw)$y)}
mednorm.ksmooth.norm <-function(x,y,bw,norm.y){mednorm.ksmooth(... | puff_rstring = '\nimpute_zeros <- function(x, y, bw){\n k <- ksmooth(x=x, y=y, bandwidth=bw)\n y[y == 0] <- k$y[y == 0]\n return(y)\n}\nmednorm <- function(x){x/median(x)}\nmednorm.ksmooth <-function(x,y,bw){mednorm(ksmooth(x=x,y=y,bandwidth = bw)$y)}\nmednorm.ksmooth.norm <-function(x,y,bw,norm.y){mednorm.ksm... |
#
# PySNMP MIB module Unisphere-Data-IP-PROFILE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-IP-PROFILE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:31:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ve... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, value_size_constraint, single_value_constraint, value_range_constraint) ... |
def checkInline(s):
i = 0
while True:
try:
if s[i] == '$':
return i
except IndexError:
return -1
i += 1
def checkOutline(s):
return s == "<p class='md-math-block'>$"
def main():
f = open("./output.txt", "w")
while True:
s = ... | def check_inline(s):
i = 0
while True:
try:
if s[i] == '$':
return i
except IndexError:
return -1
i += 1
def check_outline(s):
return s == "<p class='md-math-block'>$"
def main():
f = open('./output.txt', 'w')
while True:
s = ... |
## Read input as specified in the question.
## Print output as specified in the question.
N = int(input())
for i in range(1, N+1):
for j in range(0, i):
x = i - 1
if x == 0:
print("1", end='')
else:
if x == j or j == 0:
print(x, end = '')
e... | n = int(input())
for i in range(1, N + 1):
for j in range(0, i):
x = i - 1
if x == 0:
print('1', end='')
elif x == j or j == 0:
print(x, end='')
else:
print(0, end='')
print() |
def solution(n):
if str(n ** (1/2))[-2] == '.': return int(((n **(1/2))+1) ** 2)
else: return -1
print(solution(121))
print(solution(3)) | def solution(n):
if str(n ** (1 / 2))[-2] == '.':
return int((n ** (1 / 2) + 1) ** 2)
else:
return -1
print(solution(121))
print(solution(3)) |
# Find the thirteen adjacent digits in the 1000-digit number that have the
# greatest product. What is the value of this product?
# Problem taken from https://projecteuler.net/problem=8
number = "73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545... | number = '7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729... |
OPTIONAL_FIELDS = [
'tags', 'consumes', 'produces', 'schemes', 'security',
'deprecated', 'operationId', 'externalDocs'
]
OPTIONAL_OAS3_FIELDS = [
'components', 'servers'
]
| optional_fields = ['tags', 'consumes', 'produces', 'schemes', 'security', 'deprecated', 'operationId', 'externalDocs']
optional_oas3_fields = ['components', 'servers'] |
rows=6
for num in range(rows):
for i in range(num):
print(num, end=" ")
print()
'''
Step for num in range(6):
step1:num=0
for i in range(0): 0,0
--------------------- skip
step2:num=1
for i in range(1): 0,1
1
step3:num=2
for i in ra... | rows = 6
for num in range(rows):
for i in range(num):
print(num, end=' ')
print()
'\nStep for num in range(6):\n step1:num=0\n for i in range(0): 0,0\n --------------------- skip\n step2:num=1\n for i in range(1): 0,1\n 1\n step3:num=2\n for i... |
class NotImplementedException(Exception):
pass
class GeolocationBackend(object):
def __init__(self, ip):
self._ip = ip
self._continent = None
self._country = None
self._geo_data = None
self._raw_data = None
def geolocate(self):
raise NotImplementedException(... | class Notimplementedexception(Exception):
pass
class Geolocationbackend(object):
def __init__(self, ip):
self._ip = ip
self._continent = None
self._country = None
self._geo_data = None
self._raw_data = None
def geolocate(self):
raise not_implemented_excepti... |
class Solution:
def missingNumber(self, arr: List[int]) -> int:
x=int(((len(arr)+1)/2)*(arr[0]+arr[-1]))
return x-sum(arr)
| class Solution:
def missing_number(self, arr: List[int]) -> int:
x = int((len(arr) + 1) / 2 * (arr[0] + arr[-1]))
return x - sum(arr) |
def deep_merge_dicts(dict1, dict2):
output = {}
# adds keys from `dict1` if they do not exist in `dict2` and vice-versa
intersection = {**dict2, **dict1}
for k_intersect, v_intersect in intersection.items():
if k_intersect not in dict1:
v_dict2 = dict2[k_intersect]
outp... | def deep_merge_dicts(dict1, dict2):
output = {}
intersection = {**dict2, **dict1}
for (k_intersect, v_intersect) in intersection.items():
if k_intersect not in dict1:
v_dict2 = dict2[k_intersect]
output[k_intersect] = v_dict2
elif k_intersect not in dict2:
... |
def sayHello(name):
'''say hello to given name'''
print(f'Hello, {name}')
| def say_hello(name):
"""say hello to given name"""
print(f'Hello, {name}') |
# Prepare the data
piedpiper=np.array([4.57, 4.55, 5.47, 4.67, 5.41, 5.55, 5.53, 5.63, 3.86, 3.97, 5.44, 3.93, 5.31, 5.17, 4.39, 4.28, 5.25])
endframe = np.array([4.27, 3.93, 4.01, 4.07, 3.87, 4. , 4. , 3.72, 4.16, 4.1 , 3.9 , 3.97, 4.08, 3.96, 3.96, 3.77, 4.09])
# Assumption check
check_normality(piedpiper)
check_nor... | piedpiper = np.array([4.57, 4.55, 5.47, 4.67, 5.41, 5.55, 5.53, 5.63, 3.86, 3.97, 5.44, 3.93, 5.31, 5.17, 4.39, 4.28, 5.25])
endframe = np.array([4.27, 3.93, 4.01, 4.07, 3.87, 4.0, 4.0, 3.72, 4.16, 4.1, 3.9, 3.97, 4.08, 3.96, 3.96, 3.77, 4.09])
check_normality(piedpiper)
check_normality(endframe)
(test, pvalue) = stats... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.