content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# App configuration CAMERA = False # Model path MODELPATH = "utils/model/" WEIGHTS = "yolov3.weights" CFG = "yolov3.cfg" COCONAMES = "coco.names" # Video path FOLDERNAME = "videos/" VIDEONAME = "TownCentre.mp4" WIDTH = 1280 HEIGHT = 720 DISTANCE = 68.5 ''' # PETS2009 FOLDERNAME = "videos/" VIDEONAME = "PETS2009.mp4"...
camera = False modelpath = 'utils/model/' weights = 'yolov3.weights' cfg = 'yolov3.cfg' coconames = 'coco.names' foldername = 'videos/' videoname = 'TownCentre.mp4' width = 1280 height = 720 distance = 68.5 '\n# PETS2009\nFOLDERNAME = "videos/"\nVIDEONAME = "PETS2009.mp4"\nWIDTH = 1280\nHEIGHT = 720\nDISTANCE = 70\n\n#...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Created by pat on 5/18/18 """ .. currentmodule::dbgdb.db.targets .. moduleauthor:: Pat Daburu <pat@daburu.net> Custom targets for the dbgdb package. """
""" .. currentmodule::dbgdb.db.targets .. moduleauthor:: Pat Daburu <pat@daburu.net> Custom targets for the dbgdb package. """
test = { 'name': 'lets-count', 'points': 0, 'suites': [ { 'cases': [ { 'code': r""" sqlite> SELECT * from fa17favnum; 69|66 sqlite> SELECT * from fa17favpets; dog|57 cat|33 dragon|14 panda|14 tiger|14 ...
test = {'name': 'lets-count', 'points': 0, 'suites': [{'cases': [{'code': '\n sqlite> SELECT * from fa17favnum;\n 69|66\n sqlite> SELECT * from fa17favpets;\n dog|57\n cat|33\n dragon|14\n panda|14\n tiger|14\n lion|13\n penguin|1...
def entrada(): experimento = input().split(' ') quant = int(experimento[0]) animal = experimento[1] return quant, animal def experiencias(numero_de_teste): quantidade_de_cobaias = dict() for teste in range(numero_de_teste): quantidade, cobaia = entrada() if cobaia not in quanti...
def entrada(): experimento = input().split(' ') quant = int(experimento[0]) animal = experimento[1] return (quant, animal) def experiencias(numero_de_teste): quantidade_de_cobaias = dict() for teste in range(numero_de_teste): (quantidade, cobaia) = entrada() if cobaia not in qua...
# Converts an enumeration to a printable string. # def enumToString(constants, enum, elem): all = constants.all_values(enum) for e in all.keys(): if str(elem) == str(all[e]): return e return "<unknown>"
def enum_to_string(constants, enum, elem): all = constants.all_values(enum) for e in all.keys(): if str(elem) == str(all[e]): return e return '<unknown>'
def disp_bot_thoughts(self,ball_prediction,target,car_location,target_future): # Get Ball Prediction Line ball_path = [0] * 300 for s in range(300): slice_location = ball_prediction.slices[s] ball_path[s] = slice_location.physics.location # Draw s...
def disp_bot_thoughts(self, ball_prediction, target, car_location, target_future): ball_path = [0] * 300 for s in range(300): slice_location = ball_prediction.slices[s] ball_path[s] = slice_location.physics.location self.renderer.draw_polyline_3d(ball_path, self.renderer.blue()) self.ren...
# Copyright 2016-2022 The FEAGI Authors. 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 required by applica...
genome = {'version': '2.0', 'max_burst_count': 3, 'burst_delay': 0.1, 'evolution_burst_count': 50, 'ipu_idle_threshold': 1000, 'neuron_morphologies': {'placeholder': {}, 'block_to_block': {'vectors': [[0, 0, 0]]}, 'decrease_filter_diagonal': {'vectors': [[0, 1, 1]]}, 'decrease_filter_diagonal2': {'vectors': [[0, 2, 1]]...
# -*- coding: utf-8 -*- """ Created on Fri Feb 19 11:04:49 2021 @author: Lakhan Kumawat """ def fibonacci(n): s=1 const=n mylist=[0,1] #print(len(mylist)-1) while(n!=0): for i in range(len(mylist)-1): s+=mylist[i] if(s<const): mylist.append...
""" Created on Fri Feb 19 11:04:49 2021 @author: Lakhan Kumawat """ def fibonacci(n): s = 1 const = n mylist = [0, 1] while n != 0: for i in range(len(mylist) - 1): s += mylist[i] if s < const: mylist.append(s) n -= 1 print(mylist) n = int(input('Ent...
class Solution: def myPow(self, x,n): ans = x**n if abs(ans) <= 10**4: return ans
class Solution: def my_pow(self, x, n): ans = x ** n if abs(ans) <= 10 ** 4: return ans
def render_result_codes(result_codes, timeout_count, connection_error_count): rc = "" for k, v in result_codes.iteritems(): rc += "%s: %s " % (k, v) if timeout_count > 0: rc += 'Timeouts: %s ' % timeout_count if connection_error_count > 0: rc += 'Connection Errors: %s...
def render_result_codes(result_codes, timeout_count, connection_error_count): rc = '' for (k, v) in result_codes.iteritems(): rc += '%s: %s ' % (k, v) if timeout_count > 0: rc += 'Timeouts: %s ' % timeout_count if connection_error_count > 0: rc += 'Connection Errors: %s...
def add_e2e_args(parser): parser.add_argument("--cuda", default=False, action="store_true") parser.add_argument("--random_seed", default=6700417, type=int) parser.add_argument("--model_name", type=str) parser.add_argument("--load_from_pretrain_s2t", type=str) parser.add_argument("--load_from_pretrai...
def add_e2e_args(parser): parser.add_argument('--cuda', default=False, action='store_true') parser.add_argument('--random_seed', default=6700417, type=int) parser.add_argument('--model_name', type=str) parser.add_argument('--load_from_pretrain_s2t', type=str) parser.add_argument('--load_from_pretrai...
__all__ = [ 'ConfigItemRequiredException', 'ConfigItemValidationException' ] class ConfigItemRequiredException(Exception): def __init__(self, key): super(ConfigItemRequiredException, self).__init__("Config item '{}' is required".format(key)) class ConfigItemValidationException(Exception): ...
__all__ = ['ConfigItemRequiredException', 'ConfigItemValidationException'] class Configitemrequiredexception(Exception): def __init__(self, key): super(ConfigItemRequiredException, self).__init__("Config item '{}' is required".format(key)) class Configitemvalidationexception(Exception): def __init__...
f = list(map(int, input().split())) x = int(input()) y = 0 for i in range(0, len(f) - 1): y += f[i] * (len(f)-i-1) * x**(len(f)-i-2) print(y)
f = list(map(int, input().split())) x = int(input()) y = 0 for i in range(0, len(f) - 1): y += f[i] * (len(f) - i - 1) * x ** (len(f) - i - 2) print(y)
"""If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000.""" def problem(n): result = 0 for i in range(0, 1000, n): result = result+i return result def main(): ...
"""If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000.""" def problem(n): result = 0 for i in range(0, 1000, n): result = result + i return result def main(): ...
# -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. class ViewIdMappingProtoProtocolAccessInfo(object): """Implementation of the 'ViewIdMappingProto_ProtocolAccessInfo' model. TODO: type model description here. Attributes: iscsi_access (int): Access control for iSCSI protocol for this view. ...
class Viewidmappingprotoprotocolaccessinfo(object): """Implementation of the 'ViewIdMappingProto_ProtocolAccessInfo' model. TODO: type model description here. Attributes: iscsi_access (int): Access control for iSCSI protocol for this view. nfs4_access (int): Access control for NFSv4.1 prot...
class Solution: def canPlaceFlowers(self, flowerbed, n) -> bool: # I spent lots of time on this question. # there are two exception: leftest is zero and rightest is zero. length = len(flowerbed) if length < 1 or length < n: return False c = 0 ...
class Solution: def can_place_flowers(self, flowerbed, n) -> bool: length = len(flowerbed) if length < 1 or length < n: return False c = 0 for i in range(length): if flowerbed[i] == 0: c += 1 if i == 0: c +=...
#!/usr/bin/env python ##################################### # Installation module for Wifite2 ##################################### # AUTHOR OF MODULE NAME AUTHOR="Dave Kennedy (@HackingDave)" # DESCRIPTION OF THE MODULE DESCRIPTION="This module will install/update wifite2 - a tool for wireless auditing" # INSTALL TY...
author = 'Dave Kennedy (@HackingDave)' description = 'This module will install/update wifite2 - a tool for wireless auditing' install_type = 'GIT' repository_location = 'https://github.com/kimocoder/wifite2' install_location = 'wifite2' debian = 'git python3' fedora = 'git python3' after_commands = 'cd {INSTALL_LOCATIO...
class Config: def config(): result ={ "mongoConnect":"mongodb+srv://bfxtest:bfxtest@bitfinextest.blkxg.mongodb.net/bfxtest?retryWrites=true&w=majority", "frrBottoken":"1481397802:AAGDYZZ6OfEGQX4dCDI4eJooKdetdb2-Smc", "apiBottoken":"", "bfxKey":"xuhKUYB70yb...
class Config: def config(): result = {'mongoConnect': 'mongodb+srv://bfxtest:bfxtest@bitfinextest.blkxg.mongodb.net/bfxtest?retryWrites=true&w=majority', 'frrBottoken': '1481397802:AAGDYZZ6OfEGQX4dCDI4eJooKdetdb2-Smc', 'apiBottoken': '', 'bfxKey': 'xuhKUYB70ybKJzgnavREMRWVGsGlITP8zNzDrudQpfw', 'bfxSec': '4...
# This program displays the population for each of the next five years in the US given that # One birth every 7 seconds # One death every 13 seconds # One new immigrant every 45 seconds # 365 days = 31536000 seconds numberOfYears = 5 currentPopulation = 312032486 numberOfSecondsIn1year = 31536000 birthsPerYear = num...
number_of_years = 5 current_population = 312032486 number_of_seconds_in1year = 31536000 births_per_year = numberOfSecondsIn1year // 7 deaths_per_year = numberOfSecondsIn1year // 13 immigrants_peryear = numberOfSecondsIn1year // 45 print('The population in ', numberOfYears, 'years', 'will be', currentPopulation + number...
# Copyright 2017 The Bazel Authors. 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 required by applicable la...
"""Rules related to Apple resources and resource bundles.""" load('@rules_cc//cc:defs.bzl', 'objc_library') load('@build_bazel_rules_apple//apple/internal/resource_rules:apple_bundle_import.bzl', _apple_bundle_import='apple_bundle_import') load('@build_bazel_rules_apple//apple/internal/resource_rules:apple_core_ml_libr...
def sum_below(n: int, condition: callable) -> int: return sum(filter(condition, range(1, n))) def condition(whitelist_numbers: list) -> int: def filter_condition(n: int, whitelist_numbers=whitelist_numbers) -> bool: for whitelist_number in whitelist_numbers: if n % whitelist_number == 0: ...
def sum_below(n: int, condition: callable) -> int: return sum(filter(condition, range(1, n))) def condition(whitelist_numbers: list) -> int: def filter_condition(n: int, whitelist_numbers=whitelist_numbers) -> bool: for whitelist_number in whitelist_numbers: if n % whitelist_number == 0: ...
# # PySNMP MIB module CTRON-ENVIRONMENT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-ENVIRONMENT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:26:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint, constraints_union) ...
# -*- coding: utf-8 -*- """ Created on Wed Jun 12 19:43:35 2019 @author: Parikshith.H """ class customer: __counter=1000 def __init__(self,NAME,NUM): self.__id=customer.__counter+1 self.__name=NAME self.__num=NUM customer.__counter=customer.__counter+1 def get_id(s...
""" Created on Wed Jun 12 19:43:35 2019 @author: Parikshith.H """ class Customer: __counter = 1000 def __init__(self, NAME, NUM): self.__id = customer.__counter + 1 self.__name = NAME self.__num = NUM customer.__counter = customer.__counter + 1 def get_id(self): r...
# as found on reddit get_vertical = lambda lst: [[y[x] for y in lst] for x in range(len(lst[0]))] get_value = lambda x, n, m: n if x.count('0') > x.count('1') else m calc_bin = lambda lst: int(''.join([str(x) for x in lst]), 2) with open("day32021_puzzle_input.txt", 'r') as file: data = file.read().splitlines() ...
get_vertical = lambda lst: [[y[x] for y in lst] for x in range(len(lst[0]))] get_value = lambda x, n, m: n if x.count('0') > x.count('1') else m calc_bin = lambda lst: int(''.join([str(x) for x in lst]), 2) with open('day32021_puzzle_input.txt', 'r') as file: data = file.read().splitlines() gamma = [get_value(x...
_base_ = "./ss_v1_dibr_mlBCE_FreezeBN_woCenter_refinePM10_ape.py" OUTPUT_DIR = "output/self6dpp/ssLM/ss_v1_dibr_mlBCE_FreezeBN_woCenter_refinePM10/cat" DATASETS = dict( TRAIN=("lm_real_cat_train",), TRAIN2=("lm_pbr_cat_train",), TRAIN2_RATIO=0.0, TEST=("lm_real_cat_test",) ) MODEL = dict( WEIGHTS="output/gdrn/l...
_base_ = './ss_v1_dibr_mlBCE_FreezeBN_woCenter_refinePM10_ape.py' output_dir = 'output/self6dpp/ssLM/ss_v1_dibr_mlBCE_FreezeBN_woCenter_refinePM10/cat' datasets = dict(TRAIN=('lm_real_cat_train',), TRAIN2=('lm_pbr_cat_train',), TRAIN2_RATIO=0.0, TEST=('lm_real_cat_test',)) model = dict(WEIGHTS='output/gdrn/lm_pbr/resne...
#https://leetcode.com/problems/maximum-product-of-three-numbers/ class Solution: def maximumProduct(self, nums: List[int]) -> int: a, b = heapq.nlargest(3, nums), heapq.nsmallest(2, nums) return max(a[0] * a[1] * a[2], b[0] * b[1] * a[0])
class Solution: def maximum_product(self, nums: List[int]) -> int: (a, b) = (heapq.nlargest(3, nums), heapq.nsmallest(2, nums)) return max(a[0] * a[1] * a[2], b[0] * b[1] * a[0])
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Aug 27 17:31:02 2018 @author: edanrein """ __version__ = "0.1.5.3"
""" Created on Mon Aug 27 17:31:02 2018 @author: edanrein """ __version__ = '0.1.5.3'
SPIDER_MODULES = ['pumpkin.spiders'] MEDIA_ALLOW_REDIRECTS = True ITEM_PIPELINES = {'pumpkin.pipelines.SongFilesPipeline': 100} FILES_STORE = 'songs'
spider_modules = ['pumpkin.spiders'] media_allow_redirects = True item_pipelines = {'pumpkin.pipelines.SongFilesPipeline': 100} files_store = 'songs'
a=int(input("Enter the first number")) b=int(input("Enter the second number")) c=int(input("Enter the third number")) d=int(input("Enter the fourth number")) total=a+b+c+d average=total/4 print("Total of the four numbers=",total,"\naverage of the four numbers=",average)
a = int(input('Enter the first number')) b = int(input('Enter the second number')) c = int(input('Enter the third number')) d = int(input('Enter the fourth number')) total = a + b + c + d average = total / 4 print('Total of the four numbers=', total, '\naverage of the four numbers=', average)
"""Utilities directly related to the `generate` step of `cargo-bazel`.""" load(":common_utils.bzl", "CARGO_BAZEL_ISOLATED", "cargo_environ", "execute") CARGO_BAZEL_GENERATOR_SHA256 = "CARGO_BAZEL_GENERATOR_SHA256" CARGO_BAZEL_GENERATOR_URL = "CARGO_BAZEL_GENERATOR_URL" CARGO_BAZEL_REPIN = "CARGO_BAZEL_REPIN" REPIN = ...
"""Utilities directly related to the `generate` step of `cargo-bazel`.""" load(':common_utils.bzl', 'CARGO_BAZEL_ISOLATED', 'cargo_environ', 'execute') cargo_bazel_generator_sha256 = 'CARGO_BAZEL_GENERATOR_SHA256' cargo_bazel_generator_url = 'CARGO_BAZEL_GENERATOR_URL' cargo_bazel_repin = 'CARGO_BAZEL_REPIN' repin = 'R...
class HashTableOpenAddressing: TOMBSTONE = 'RIP' MINSIZE = 8 def __init__(self, **initial_values): self._buckets = [() for _ in range(self.MINSIZE)] for k, v in initial_values.items(): self.insert(k, v) def get(self, key): _, myid = self._computeHash(key) b...
class Hashtableopenaddressing: tombstone = 'RIP' minsize = 8 def __init__(self, **initial_values): self._buckets = [() for _ in range(self.MINSIZE)] for (k, v) in initial_values.items(): self.insert(k, v) def get(self, key): (_, myid) = self._computeHash(key) ...
# # @lc app=leetcode id=118 lang=python3 # # [118] Pascal's Triangle # # https://leetcode.com/problems/pascals-triangle/description/ # # algorithms # Easy (61.80%) # Likes: 4609 # Dislikes: 188 # Total Accepted: 684.3K # Total Submissions: 1.1M # Testcase Example: '5' # # Given an integer numRows, return the fir...
class Solution: def generate(self, numRows: int) -> List[List[int]]: pascal = [[1] * (i + 1) for i in range(numRows)] for i in range(1, numRows): for j in range(1, i): pascal[i][j] = pascal[i - 1][j - 1] + pascal[i - 1][j] return pascal
# hello3.py def hello(): print("Hello, world!") # A test: hello()
def hello(): print('Hello, world!') hello()
#!/usr/bin/python # https://practice.geeksforgeeks.org/problems/save-ironman/0 def sol(s): n = len(s) #print(s[0], s[-1]) l = 0 r = n-1 while l < r: lv = False rv = False cl = s[l].lower() cr = s[r].lower() if cl.isdigit() or cl.isalpha(): ...
def sol(s): n = len(s) l = 0 r = n - 1 while l < r: lv = False rv = False cl = s[l].lower() cr = s[r].lower() if cl.isdigit() or cl.isalpha(): lv = True if cr.isdigit() or cr.isalpha(): rv = True if lv and rv: if...
""" This file will contain different constraint propagators to be used within bt_search. propagator == a function with the following template propagator(csp, newly_instantiated_variable=None) ==> returns (True/False, [(Variable, Value), (Variable, Value) ...] csp is a CSP object---the pro...
""" This file will contain different constraint propagators to be used within bt_search. propagator == a function with the following template propagator(csp, newly_instantiated_variable=None) ==> returns (True/False, [(Variable, Value), (Variable, Value) ...] csp is a CSP object---the pro...
# Repear n/2 iterations. Replace 4 points in one go. class Solution: def rotate(self, matrix: List[List[int]]) -> None: """ Do not return anything, modify matrix in-place instead. """ n = len(matrix[0]) iterations = n//2 for itr in range(iterations): ...
class Solution: def rotate(self, matrix: List[List[int]]) -> None: """ Do not return anything, modify matrix in-place instead. """ n = len(matrix[0]) iterations = n // 2 for itr in range(iterations): for offset in range(itr, n - itr - 1): ...
model = 'basic' train_file = 'data/jersey_crops_trash_train.txt' val_file = 'data/jersey_crops_trash_val.txt' exp = 'basic_newdata_trash_32' batch_size = 32 learning_rate = 0.01 decay_steps = 10000 decay_rate = 0.9 img_size = 40 crop_size = 32 inter_size = 5
model = 'basic' train_file = 'data/jersey_crops_trash_train.txt' val_file = 'data/jersey_crops_trash_val.txt' exp = 'basic_newdata_trash_32' batch_size = 32 learning_rate = 0.01 decay_steps = 10000 decay_rate = 0.9 img_size = 40 crop_size = 32 inter_size = 5
def order(choice,location = "Mohakhali"): menu = { "BBQ Chicken Cheese Burger": 250, "Beef Burger": 170, "Naga Drums":200 } item = menu[choice] item += item * 0.08 if location == "Mohakhali": item += 40 else: item += 60 return item item = input...
def order(choice, location='Mohakhali'): menu = {'BBQ Chicken Cheese Burger': 250, 'Beef Burger': 170, 'Naga Drums': 200} item = menu[choice] item += item * 0.08 if location == 'Mohakhali': item += 40 else: item += 60 return item item = input('ITEM: ') location = input('Location:...
class Shape: def __init__(self, x, y): self.x = x self.y = y self.description = "defined later" self.author = "Nobody as of yet" #methods def area(self): return self.x * self.y def perimeter(self): return 2 * self.x + 2 * self.y def describe(self, tex...
class Shape: def __init__(self, x, y): self.x = x self.y = y self.description = 'defined later' self.author = 'Nobody as of yet' def area(self): return self.x * self.y def perimeter(self): return 2 * self.x + 2 * self.y def describe(self, text): ...
# @dploy endpoint xyz # @dploy json_to_kwargs def xyz(a, b, c): return a + b + c
def xyz(a, b, c): return a + b + c
ACKGNOWLEDGE_MSG = [ "Roger, will assign the task to a teammate", "Hang tight, we will find someone for you request shortly", "Okey-dokey, one teammember for your request coming up :ack:", ] CALL_TO_ACTION_MSG = [ "Are you up for it?", "GO GO GO (...?) :runner:", "Prove to the world how awesome...
ackgnowledge_msg = ['Roger, will assign the task to a teammate', 'Hang tight, we will find someone for you request shortly', 'Okey-dokey, one teammember for your request coming up :ack:'] call_to_action_msg = ['Are you up for it?', 'GO GO GO (...?) :runner:', 'Prove to the world how awesome you are?'] timeout_msg = ["I...
class Character: def __init__(slef): # Physically Defining Characteristics self.name = "Default Name" self.age = '' self.sex = '' self.species = 'human' # Interpersonal Characteristics self.agression = '' # Object Data sel...
class Character: def __init__(slef): self.name = 'Default Name' self.age = '' self.sex = '' self.species = 'human' self.agression = '' self.relationships = [] self.memory = [] def interaction(self, person): pass
pkgname = "fonts-liberation" pkgver = "2.1.5" pkgrel = 0 build_style = "makefile" make_cmd = "gmake" hostmakedepends = ["gmake", "fontforge-cli", "python-fonttools"] depends = ["mkfontscale"] pkgdesc = "Liberation family of fonts - OpenType" maintainer = "q66 <q66@chimera-linux.org>" license = "OFL-1.1" url = "https://...
pkgname = 'fonts-liberation' pkgver = '2.1.5' pkgrel = 0 build_style = 'makefile' make_cmd = 'gmake' hostmakedepends = ['gmake', 'fontforge-cli', 'python-fonttools'] depends = ['mkfontscale'] pkgdesc = 'Liberation family of fonts - OpenType' maintainer = 'q66 <q66@chimera-linux.org>' license = 'OFL-1.1' url = 'https://...
class TextInput: def __init__(self, id, initial, placeholder, readonly, style=None): self.id = id self._impl = None self.initial = initial self.placeholder = placeholder self.readonly = readonly self.style = style def __html__(self): return ( ...
class Textinput: def __init__(self, id, initial, placeholder, readonly, style=None): self.id = id self._impl = None self.initial = initial self.placeholder = placeholder self.readonly = readonly self.style = style def __html__(self): return '<input id="t...
# -*- coding: utf-8 -*- """ Created on Mon Dec 21 10:20:55 2020 @author: celine.gross """ with open('input_day17.txt', 'r') as file: puzzle = [[l for l in line.strip()] for line in file] # Part 1 def create_positions(data): active = set() for x, row in enumerate(data): for y, col in enumerate(r...
""" Created on Mon Dec 21 10:20:55 2020 @author: celine.gross """ with open('input_day17.txt', 'r') as file: puzzle = [[l for l in line.strip()] for line in file] def create_positions(data): active = set() for (x, row) in enumerate(data): for (y, col) in enumerate(row): if col == '#': ...
class Payload: def __init__(self, host: str, port: int, strs: list): self.host, self.port, self.strs = host, port, strs def create(self): return """ def {sendfile}(file, conn):\n\tconn.send("!!!".encode("UTF-8")) \twith open(file , 'rb') as f: \t\tconn.send(str(len(f.read())).encode("UTF-8"))\n...
class Payload: def __init__(self, host: str, port: int, strs: list): (self.host, self.port, self.strs) = (host, port, strs) def create(self): return '\ndef {sendfile}(file, conn):\n\tconn.send("!!!".encode("UTF-8"))\n\twith open(file , \'rb\') as f:\n\t\tconn.send(str(len(f.read())).encode("UT...
########################################################################## # # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2020, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## """pgagent helper...
"""pgagent helper utilities""" def format_boolean_array(value): """ Converts to proper array data for sql Args: value: data to be converted Returns: Converted data """ if not isinstance(value, list): return value.replace('[', '{').replace(']', '}') return value def...
# Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Presubmit script for changes affecting //ui/views. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about the...
"""Presubmit script for changes affecting //ui/views. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about the presubmit API built into depot_tools. """ include_cpp_files_only = ('.*\\.(cc|h)$',) def check_change_lints_clean(input_api, output_api): """Makes sure that ...
owner_id = 1221558981 bot_token = "1641954476:AAG-EBjPfq8mj7OI6odusgtAa13j9xCQyOo" bot_id = 1641954476 # Leave it as it is ARQ_API_BASE_URL = "https://thearq.tech"
owner_id = 1221558981 bot_token = '1641954476:AAG-EBjPfq8mj7OI6odusgtAa13j9xCQyOo' bot_id = 1641954476 arq_api_base_url = 'https://thearq.tech'
n=int(input()) su=0 ma=0 for x in range(0,n): s=input() s=s.split(' ') su=su-int(s[0])+int(s[1]) if ma<su: ma=su print(ma)
n = int(input()) su = 0 ma = 0 for x in range(0, n): s = input() s = s.split(' ') su = su - int(s[0]) + int(s[1]) if ma < su: ma = su print(ma)
#encoding:utf-8 subreddit = 'netflixbestof+bestofnetflix+movie_club+truefilm+shittymoviedetails+ijustwatched' t_channel = '@r_movieclub' def send_post(submission, r2t): return r2t.send_simple(submission)
subreddit = 'netflixbestof+bestofnetflix+movie_club+truefilm+shittymoviedetails+ijustwatched' t_channel = '@r_movieclub' def send_post(submission, r2t): return r2t.send_simple(submission)
class Solution: def isAnagram(self, s, t): """ :type s: str :type t: str :rtype: bool """ if len(s) != len(t): return False m = {} for c in s: m[c] = m.get(c, 0) + 1 for c in t: if not c in m: ...
class Solution: def is_anagram(self, s, t): """ :type s: str :type t: str :rtype: bool """ if len(s) != len(t): return False m = {} for c in s: m[c] = m.get(c, 0) + 1 for c in t: if not c in m: ...
def validSolution(board): temp = [] for row in board: for i in range(1, 10): if i not in row: return False for column in range(0, 9): temp = [] for row in board: temp.append(row[column]) for i in range(1, 10): if i not in...
def valid_solution(board): temp = [] for row in board: for i in range(1, 10): if i not in row: return False for column in range(0, 9): temp = [] for row in board: temp.append(row[column]) for i in range(1, 10): if i not in t...
# intentions PLAY = 0 DISCARD = 1 KEEP = 2 def utility(intention, card, state, knowledge): """ return a utility for a single card of a given realisation from various realisations """ def CardUseless(card, fireworks): """ return True if the card can be surely discarded """ ...
play = 0 discard = 1 keep = 2 def utility(intention, card, state, knowledge): """ return a utility for a single card of a given realisation from various realisations """ def card_useless(card, fireworks): """ return True if the card can be surely discarded """ if fi...
def main(): position = [0, 0] with open("day_2_input.txt") as f: for line in f.readlines(): cmd, unit = line.split() if cmd == "forward": position[0] += int(unit) elif cmd == "down": position[1] += int(unit) elif cmd == "up"...
def main(): position = [0, 0] with open('day_2_input.txt') as f: for line in f.readlines(): (cmd, unit) = line.split() if cmd == 'forward': position[0] += int(unit) elif cmd == 'down': position[1] += int(unit) elif cmd == 'u...
"""Script to be called by Abaqus CAE upon a session starting. This script is meant to be called upon Abaqus opening a new session, to run batch commands automatically. Developed by Rodrigo Rivero. https://github.com/rodrigo1392 """ print('EXECUTING FIRST SCRIPT')
"""Script to be called by Abaqus CAE upon a session starting. This script is meant to be called upon Abaqus opening a new session, to run batch commands automatically. Developed by Rodrigo Rivero. https://github.com/rodrigo1392 """ print('EXECUTING FIRST SCRIPT')
#convert units of the same type and different scales def scaleUnits(initial_unit, final_unit, unit_dict): initial_factor = unit_dict[initial_unit]['factor'] final_factor = unit_dict[final_unit]['factor'] return lambda x : (x / initial_factor) * final_factor #convert unit to standard unit for unit type def...
def scale_units(initial_unit, final_unit, unit_dict): initial_factor = unit_dict[initial_unit]['factor'] final_factor = unit_dict[final_unit]['factor'] return lambda x: x / initial_factor * final_factor def scale_to_base(initial_unit, unit_dict): initial_factor = unit_dict[initial_unit]['factor'] r...
# Only used for PyTorch open source BUCK build # @lint-ignore-every BUCKRESTRICTEDSYNTAX load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary") def fb_python_binary(**kwgs): if read_config("pt", "is_oss", "0") == "0": fail("This file is for open source pytorch build. Do not use it in fbsour...
load('@fbcode_macros//build_defs:python_binary.bzl', 'python_binary') def fb_python_binary(**kwgs): if read_config('pt', 'is_oss', '0') == '0': fail('This file is for open source pytorch build. Do not use it in fbsource!') python_binary(**kwgs)
def add(x, y): return x+y def sub(x, y): return x-y
def add(x, y): return x + y def sub(x, y): return x - y
def wrap(string, max_width): """ Takes in a string of length n and an integer max_width < n, and returns the string wrapped with lines no longer then max_width chars. Parameters ---------- string : string Input string. max_width : int Max number of chars before insertin...
def wrap(string, max_width): """ Takes in a string of length n and an integer max_width < n, and returns the string wrapped with lines no longer then max_width chars. Parameters ---------- string : string Input string. max_width : int Max number of chars before insertin...
class StlParser(): def file_open(self, file_path): with open(file_path) as f: l = f.readlines() return l def format_stl_vertex_to_str(self, stl_vertex): ### "vertex xx yy zz" >> "xx,yy,zz" stl_vertex_rm = stl_vertex.replace("\n",...
class Stlparser: def file_open(self, file_path): with open(file_path) as f: l = f.readlines() return l def format_stl_vertex_to_str(self, stl_vertex): stl_vertex_rm = stl_vertex.replace('\n', '') stl_vertex_sp = stl_vertex_rm.split(' ') x = float(stl_vertex_...
# Created by Egor Kostan. # GitHub: https://github.com/ikostan # LinkedIn: https://www.linkedin.com/in/egor-kostan/ def is_palindrome(s: str) -> bool: """ Write function isPalindrome that checks if a given string (case insensitive) is a palindrome. :param s: :return: """ s = s.lower() ...
def is_palindrome(s: str) -> bool: """ Write function isPalindrome that checks if a given string (case insensitive) is a palindrome. :param s: :return: """ s = s.lower() return s == s[::-1]
filename_prefix = 'SawyerPush-Abl-Alpha-ASR' xlabel = 'Environment steps (1.2M)' ylabel = "Average Success Rate" max_step = 1200000 max_y_axis_value = 1.0 legend = True data_key = "train_ep/episode_success" bc_y_value = 0 plot_labels = { r'log($\alpha$): 0.5': ['abl._3DPush_ours_log_alpha_0.5_upbeat-serenity-599']...
filename_prefix = 'SawyerPush-Abl-Alpha-ASR' xlabel = 'Environment steps (1.2M)' ylabel = 'Average Success Rate' max_step = 1200000 max_y_axis_value = 1.0 legend = True data_key = 'train_ep/episode_success' bc_y_value = 0 plot_labels = {'log($\\alpha$): 0.5': ['abl._3DPush_ours_log_alpha_0.5_upbeat-serenity-599'], 'log...
""" File: abstract.py Author: Come Bertrand Email: bertrand.cosme@gmail.com Github: https://github.com/ComeBertrand Description: Base classes for the Metaheuristics. """ class Metaheuristic(object): """Optimization computer that will work on a Problem. Args: problem (Problem): the problem to be optim...
""" File: abstract.py Author: Come Bertrand Email: bertrand.cosme@gmail.com Github: https://github.com/ComeBertrand Description: Base classes for the Metaheuristics. """ class Metaheuristic(object): """Optimization computer that will work on a Problem. Args: problem (Problem): the problem to be optimi...
valor = int(input('Digite um valor: ')) x1 = valor * 1 x2 = valor * 2 x3 = valor * 3 x4 = valor * 4 x5 = valor * 5 x6 = valor * 6 x7 = valor * 7 x8 = valor * 8 x9 = valor * 9 x10 = valor * 10 print('1 x {} = {}'.format(valor, x1)) print('2 x {} = {}'.format(valor, x2)) print('3 x {} = {}'.format(valor, x3)) print('4 ...
valor = int(input('Digite um valor: ')) x1 = valor * 1 x2 = valor * 2 x3 = valor * 3 x4 = valor * 4 x5 = valor * 5 x6 = valor * 6 x7 = valor * 7 x8 = valor * 8 x9 = valor * 9 x10 = valor * 10 print('1 x {} = {}'.format(valor, x1)) print('2 x {} = {}'.format(valor, x2)) print('3 x {} = {}'.format(valor, x3)) print('4 x ...
timezone = node.metadata.get('timezone', 'UTC') actions = { 'systemd-daemon-reload': { 'command': 'systemctl daemon-reload', 'triggered': True, 'needed_by': ['svc_systemd:'], }, 'timedatectl-set-timezone': { 'command': 'timedatectl set-timezone ' + timezone, 'unless'...
timezone = node.metadata.get('timezone', 'UTC') actions = {'systemd-daemon-reload': {'command': 'systemctl daemon-reload', 'triggered': True, 'needed_by': ['svc_systemd:']}, 'timedatectl-set-timezone': {'command': 'timedatectl set-timezone ' + timezone, 'unless': 'timedatectl | grep -F " Time zone: {} "'.format(timezon...
# -*- coding: utf-8 -*- """ Created on Thu May 7 07:27:08 2020 @author: Ciaran """
""" Created on Thu May 7 07:27:08 2020 @author: Ciaran """
{ "targets": [ { "includes": [ "auto.gypi" ], "sources": [ "lib/Patricia.cc", "lib/PatriciaCursor.cc", "lib/Namespace.cc", "lib/ParserConfig.cc", "lib/Parser.cc" ] } ], "includes": [ "auto-top.gypi" ] }
{'targets': [{'includes': ['auto.gypi'], 'sources': ['lib/Patricia.cc', 'lib/PatriciaCursor.cc', 'lib/Namespace.cc', 'lib/ParserConfig.cc', 'lib/Parser.cc']}], 'includes': ['auto-top.gypi']}
RAWDATA_DIR = '/staging/as/skchoudh/re-ribo-datasets/GRCz11/SRP033369' OUT_DIR = '/staging/as/skchoudh/re-ribo-analysis/GRCz11/SRP033369' GENOME_FASTA = '/home/cmb-06/as/skchoudh/genomes/GRCz11/fasta/Danio_rerio.GRCz11.dna.primary_assembly.fa' CHROM_SIZES = '/home/cmb-06/as/skchoudh/genomes/GRCz11/fasta/Danio_rerio.GRC...
rawdata_dir = '/staging/as/skchoudh/re-ribo-datasets/GRCz11/SRP033369' out_dir = '/staging/as/skchoudh/re-ribo-analysis/GRCz11/SRP033369' genome_fasta = '/home/cmb-06/as/skchoudh/genomes/GRCz11/fasta/Danio_rerio.GRCz11.dna.primary_assembly.fa' chrom_sizes = '/home/cmb-06/as/skchoudh/genomes/GRCz11/fasta/Danio_rerio.GRC...
def iot_gen(): print("iot_gen 1") yield 'a' print("iot_gen 2") print("iot_gen 2") yield 'b' print("iot_gen 3") print("iot_gen 3") print("iot_gen 3") yield 'c' print(next(iot_gen())) print(next(iot_gen())) print(next(iot_gen())) gen = iot_gen() print(next(gen)) print(next(gen)) pri...
def iot_gen(): print('iot_gen 1') yield 'a' print('iot_gen 2') print('iot_gen 2') yield 'b' print('iot_gen 3') print('iot_gen 3') print('iot_gen 3') yield 'c' print(next(iot_gen())) print(next(iot_gen())) print(next(iot_gen())) gen = iot_gen() print(next(gen)) print(next(gen)) print(...
for _ in range(int(input())): candidate = int(input()) if (candidate == 2): print("Prime") elif (candidate % 2 == 0 or candidate < 2): print("Not prime") else: for i in range(3, int(candidate ** (1 / 2)) + 1, 2): if candidate % i == 0: print("Not prime...
for _ in range(int(input())): candidate = int(input()) if candidate == 2: print('Prime') elif candidate % 2 == 0 or candidate < 2: print('Not prime') else: for i in range(3, int(candidate ** (1 / 2)) + 1, 2): if candidate % i == 0: print('Not prime') ...
def ordenInsercion(lista): for i in range(len(lista)-1): if lista[i+1]<lista[i]: reubicar(lista, i+1) print(lista) def reubicar(lista,p): v=lista[p] j=p while j>0 and v<lista[j-1]: lista[j]=lista[j-1] j-=1 lista[j]=v
def orden_insercion(lista): for i in range(len(lista) - 1): if lista[i + 1] < lista[i]: reubicar(lista, i + 1) print(lista) def reubicar(lista, p): v = lista[p] j = p while j > 0 and v < lista[j - 1]: lista[j] = lista[j - 1] j -= 1 lista[j] = v
cities = [ 'Adamsville', 'Albion', 'Ashaway', 'Barrington', 'Block Island', 'Bradford', 'Bristol', 'Carolina', 'Central Falls', 'Charlestown', 'Chepachet', 'Clayville', 'Coventry', 'Cranston', 'Cumberland', 'East Greenwich', 'East Providence', 'Exe...
cities = ['Adamsville', 'Albion', 'Ashaway', 'Barrington', 'Block Island', 'Bradford', 'Bristol', 'Carolina', 'Central Falls', 'Charlestown', 'Chepachet', 'Clayville', 'Coventry', 'Cranston', 'Cumberland', 'East Greenwich', 'East Providence', 'Exeter', 'Fiskeville', 'Forestdale', 'Foster', 'Glendale', 'Greene', 'Greenv...
#This script is used to analyze the sequencing error profile if __name__=="__main__": f=open('error_profile_reads.txt',"r") # Opens file for reading output = open('error_profile_reads_processed.txt', 'w') i=0 for line in f: if i==0: i=i+1 output.write(line) co...
if __name__ == '__main__': f = open('error_profile_reads.txt', 'r') output = open('error_profile_reads_processed.txt', 'w') i = 0 for line in f: if i == 0: i = i + 1 output.write(line) continue clean = line.strip('\t\n') num = clean.split('\t')...
class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: # dicts are hashmaps hashmap = {} for i in range(len(nums)): compl = target - nums[i] if compl in hashmap: return [i,hashmap[compl]] hashmap[nums[i]] = i
class Solution: def two_sum(self, nums: List[int], target: int) -> List[int]: hashmap = {} for i in range(len(nums)): compl = target - nums[i] if compl in hashmap: return [i, hashmap[compl]] hashmap[nums[i]] = i
n = int(input("Enter the number : ")) i=1 s="" while(i<n+1): s += str(i) i+=1 print(s)
n = int(input('Enter the number : ')) i = 1 s = '' while i < n + 1: s += str(i) i += 1 print(s)
""" Semi-Quantum Conference Key Agreement (SQCKA) Author: - Ruben Andre Barreiro (r.barreiro@campus.fct.unl.pt) Supervisors: - Andre Nuno Souto (ansouto@fc.ul.pt) - Antonio Maria Ravara (aravara@fct.unl.pt) Acknowledgments: - Paulo Alexandre Mateus (pmat@math.ist.utl.pt) """ # Class for IBM Qiskit's Round for the ...
""" Semi-Quantum Conference Key Agreement (SQCKA) Author: - Ruben Andre Barreiro (r.barreiro@campus.fct.unl.pt) Supervisors: - Andre Nuno Souto (ansouto@fc.ul.pt) - Antonio Maria Ravara (aravara@fct.unl.pt) Acknowledgments: - Paulo Alexandre Mateus (pmat@math.ist.utl.pt) """ class Qiskitsqckaprotocolround: def...
# Time: O(n) # Space: O(h) class Solution(object): def findBottomLeftValue(self, root): """ :type root: TreeNode :rtype: int """ def findBottomLeftValueHelper(root, curr_depth, max_depth, bottom_left_value): if not root: return max_dep...
class Solution(object): def find_bottom_left_value(self, root): """ :type root: TreeNode :rtype: int """ def find_bottom_left_value_helper(root, curr_depth, max_depth, bottom_left_value): if not root: return (max_depth, bottom_left_value) ...
# Copyright 2016-2021 Swiss National Supercomputing Centre (CSCS/ETH Zurich) # ReFrame Project Developers. See the top-level LICENSE file for details. # # SPDX-License-Identifier: BSD-3-Clause # # Generic fallback configuration # site_configuration = { 'systems': [ { 'name': 'generic', ...
site_configuration = {'systems': [{'name': 'generic', 'descr': 'Generic example system', 'hostnames': ['.*'], 'modules_system': 'tmod32', 'partitions': [{'name': 'default', 'scheduler': 'local', 'launcher': 'local', 'environs': ['builtin']}]}], 'environments': [{'name': 'builtin', 'cc': 'cc', 'cxx': '', 'ftn': ''}], 'l...
# flake8: noqa # type: ignore """Mock linters.""" # pylint: skip-file __all__ = ['mgl'] class Implementation: class Error(Exception): """ModernGL Error.""" filename = None function = None line = None def strsize(self, *args) -> int: """strsize.""" return 0 ...
"""Mock linters.""" __all__ = ['mgl'] class Implementation: class Error(Exception): """ModernGL Error.""" filename = None function = None line = None def strsize(self, *args) -> int: """strsize.""" return 0 def create_context(self, *args) -> 'Context': ...
load("@rules_proto//proto:defs.bzl", "ProtoInfo") load("@rules_cc//cc:toolchain_utils.bzl", "find_cpp_toolchain") def _nanopb_proto_library_impl(ctx): # This is the folder we will place all our generation artifacts in generation_folder_name = ctx.attr.name + "_nanopb_gen/" # Generate import flags for the ...
load('@rules_proto//proto:defs.bzl', 'ProtoInfo') load('@rules_cc//cc:toolchain_utils.bzl', 'find_cpp_toolchain') def _nanopb_proto_library_impl(ctx): generation_folder_name = ctx.attr.name + '_nanopb_gen/' all_proto_files = depset() for dep in ctx.attr.deps: all_proto_files = depset(transitive=[al...
# # PySNMP MIB module STN-PRODUCTS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/STN-PRODUCTS-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:11:35 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, value_size_constraint, constraints_intersection) ...
""" check some imp module functions (unfinished) """ """ Does not work, will never work. import sys import imp fm = imp.find_module("test095m") print fm r = imp.load_module("test095m", fm[0], fm[1], fm[2]) print r print "her1" print r.__dict__.keys() print r.__dict__['__path__'] print sys.modules['test095m'] """
""" check some imp module functions (unfinished) """ ' Does not work, will never work.\n\nimport sys\nimport imp\n\nfm = imp.find_module("test095m")\nprint fm\n\nr = imp.load_module("test095m", fm[0], fm[1], fm[2])\nprint r\nprint "her1"\nprint r.__dict__.keys()\nprint r.__dict__[\'__path__\']\n\nprint sys.modules[\'te...
nama = input("Nama Mhs:") nim = input("Nim Mhs:") prodi = input("Prodi:") kelas = input("Kelas:") if(prodi == "informatika"): semester = 1 if(kelas == "A"): matkul = "algoritma pemrograman" elif(kelas == "B"): matkul = "algoritma struktur data" elif(kelas == "C"): ma...
nama = input('Nama Mhs:') nim = input('Nim Mhs:') prodi = input('Prodi:') kelas = input('Kelas:') if prodi == 'informatika': semester = 1 if kelas == 'A': matkul = 'algoritma pemrograman' elif kelas == 'B': matkul = 'algoritma struktur data' elif kelas == 'C': matkul = 'sitem dig...
#https://leetcode.com/problems/delete-node-in-a-bst/submissions/ # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def findMinimum(self , root): cur...
class Solution: def find_minimum(self, root): current = root while current.left: current = current.left return current def delete_node(self, root: TreeNode, key: int) -> TreeNode: if not root: return root elif key < root.val: root.lef...
# coding=utf-8 """ module document """ class a(object): """ class document """ def __init__(self): """ init document """ pass def func_a(self, arg1): """ func_a document :param arg1: arg1 document :return: return document ...
""" module document """ class A(object): """ class document """ def __init__(self): """ init document """ pass def func_a(self, arg1): """ func_a document :param arg1: arg1 document :return: return document """ ...
class ATM: def __init__(self, balance, bank_name): self.balance = balance self.bank_name = bank_name self.withdrawals_list = [] def calcul(self,request): self.withdrawals_list.append(request) self.balance -= request notes =[100,50,10,5] for note i...
class Atm: def __init__(self, balance, bank_name): self.balance = balance self.bank_name = bank_name self.withdrawals_list = [] def calcul(self, request): self.withdrawals_list.append(request) self.balance -= request notes = [100, 50, 10, 5] for note in ...
def backwards(filename): source = makeSound(filename) target = makeSound(filename) sourceIndex = getLength(source) for targetIndex in range(1, getLength(target)+1): sourceValue = getSampleValueAt(source, sourceIndex) setSampleValueAt(target, targetIndex, sourceValue) sourceIndex = sourceIndex - 1 ...
def backwards(filename): source = make_sound(filename) target = make_sound(filename) source_index = get_length(source) for target_index in range(1, get_length(target) + 1): source_value = get_sample_value_at(source, sourceIndex) set_sample_value_at(target, targetIndex, sourceValue) ...
""" --- Day 5: Binary Boarding --- You board your plane only to discover a new problem: you dropped your boarding pass! You aren't sure which seat is yours, and all of the flight attendants are busy with the flood of people that suddenly made it through passport control. You write a quick program to use your phone's ...
""" --- Day 5: Binary Boarding --- You board your plane only to discover a new problem: you dropped your boarding pass! You aren't sure which seat is yours, and all of the flight attendants are busy with the flood of people that suddenly made it through passport control. You write a quick program to use your phone's ...
'''A rectangular array of quantities or expressions in rows and columns that is treated as a single entity and manipulated according to particular rules.''' ''' Representation: List of Lists Properties: rows, cols, A Methods: row Swap - Elementary Row Operation row Multiply - Elementary Row operation row S...
"""A rectangular array of quantities or expressions in rows and columns that is treated as a single entity and manipulated according to particular rules.""" "\nRepresentation: List of Lists\nProperties: rows, cols, A\nMethods: \n row Swap - Elementary Row Operation\n row Multiply - Elementary Row operation\n r...
a, b, c, k = map(int, input().split()) if k % 2 == 0: print(a - b) else: print(b - a)
(a, b, c, k) = map(int, input().split()) if k % 2 == 0: print(a - b) else: print(b - a)
#!/usr/bin/python3 text={ "smart-upload": "smart-upload", "maintanence": "maintanence", }
text = {'smart-upload': 'smart-upload', 'maintanence': 'maintanence'}
# O(n) time | O(h) space - where n is the number of nodes in the Binary Tree and h is the height of the Binary Tree def nodeDepths(root): sumOfDepth = 0 stack = [{'node': root, 'depth': 0}] while len(stack) > 0: nodeInfo = stack.pop() node, depth = nodeInfo['node'], nodeInfo['depth'] # moves onto next loop, do...
def node_depths(root): sum_of_depth = 0 stack = [{'node': root, 'depth': 0}] while len(stack) > 0: node_info = stack.pop() (node, depth) = (nodeInfo['node'], nodeInfo['depth']) if node is None: continue sum_of_depth += depth stack.append({'node': node.left...
""" read raw_data from files """ # !/usr/bin/env python # coding=utf-8 # Read data and read tree fuctions for INFORMS data # attributes ['age', 'workcalss', 'final_weight', 'education', 'education_num', 'matrital_status', # 'occupation','relationship', 'race', 'sex', 'capital_gain', 'capital_loss', 'hours_per_week', ...
""" read raw_data from files """ gl_att_names = ['DUID', 'PID', 'DUPERSID', 'DOBMM', 'DOBYY', 'SEX', 'RACEX', 'RACEAX', 'RACEBX', 'RACEWX', 'RACETHNX', 'HISPANX', 'HISPCAT', 'EDUCYEAR', 'Year', 'marry', 'income', 'poverty'] gl_qi_index = [3, 4, 6, 13, 16] gl_sa_index = 6 __debug = False def read_data(): """ re...
# -*- coding: utf-8 -*- """ Created on Sun Sep 16 15:58:22 2018 @author: user """
""" Created on Sun Sep 16 15:58:22 2018 @author: user """
'd' class Ccc: 'd' def __init__(self, c): pass class Ddd: 'd' def __init__(self): self.ccc = Ccc(1)
"""d""" class Ccc: """d""" def __init__(self, c): pass class Ddd: """d""" def __init__(self): self.ccc = ccc(1)
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ @File : 730.py @Contact : huanghoward@foxmail.com @Modify Time : 2022/6/10 13:48 ------------ """ class Solution: def countPalindromicSubsequences(self, s: str) -> int: n = len(s) ans = set() for i in range(n): ...
""" @File : 730.py @Contact : huanghoward@foxmail.com @Modify Time : 2022/6/10 13:48 ------------ """ class Solution: def count_palindromic_subsequences(self, s: str) -> int: n = len(s) ans = set() for i in range(n): for j in range(i + 1, n + 1): ...
add_library('sound') mic = None amp = None def setup(): global mic, amp size(440, 440) background(0) mic = AudioIn(this, 0) mic.start() amp = Amplitude(this) amp.input(mic) def draw(): noStroke() fill(26, 76, 102, 10) rect(0, 0, width, height) diameter ...
add_library('sound') mic = None amp = None def setup(): global mic, amp size(440, 440) background(0) mic = audio_in(this, 0) mic.start() amp = amplitude(this) amp.input(mic) def draw(): no_stroke() fill(26, 76, 102, 10) rect(0, 0, width, height) diameter = map(amp.analyze()...
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # Input File !!! #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # Propagation method [can be CCS, MCEv1, MCEv2, or MCE12 (u...
method = 'MCEv1' cmprss = 'YES' conjugate__repeats = 'NO' systems = {'System': 'SB', 'SpecDen': 'EXP', 'freqflg': 0} parameters = {'ndim': 50, 'in_nbf': 2, 'randfunc': 'ZBQL', 'npes': 2, 'in_PES': 1, 'basis': 'SWARM', 'qss': 0} train = {'trainsp': 300, 'train_len': 10, 'swtrn_swarm_size': 50} clone = {'Cloning': 'no', ...
#!/usr/bin/python3 max_integer = __import__('9-max_integer').max_integer my_list = [1, 90, 2, 13, 34, 5, -13, 3] max_value = max_integer(my_list) print("Max: {}".format(max_value))
max_integer = __import__('9-max_integer').max_integer my_list = [1, 90, 2, 13, 34, 5, -13, 3] max_value = max_integer(my_list) print('Max: {}'.format(max_value))