content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def conciseReadInput(inputFileName): try: fin = open(inputFileName,'r') dataList = fin.readlines() fin.close() except: print(( " ERROR! Can't open file '" + inputFileName + "'")) return False i=0 while i < len(dataList): if dataList[i].lstr...
def concise_read_input(inputFileName): try: fin = open(inputFileName, 'r') data_list = fin.readlines() fin.close() except: print(" ERROR! Can't open file '" + inputFileName + "'") return False i = 0 while i < len(dataList): if dataList[i].lstrip() == '' o...
class CryptoError(Exception): ''' General Exception raised by this library if an error occurs not covered below ''' pass class InvalidTokenException(Exception): ''' Raised if there is an issue with the JWT and/or JWE headers and payloads ''' def __init__(self, value="This token is invalid"): ...
class Cryptoerror(Exception): """ General Exception raised by this library if an error occurs not covered below """ pass class Invalidtokenexception(Exception): """ Raised if there is an issue with the JWT and/or JWE headers and payloads """ def __init__(self, value='This token is invalid'): s...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"show_cv2": "00_core.ipynb", "blur": "00_core.ipynb", "pixelate": "00_core.ipynb", "find_faces": "00_core.ipynb", "blur_areas": "00_core.ipynb", "anonymize": "00_c...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'show_cv2': '00_core.ipynb', 'blur': '00_core.ipynb', 'pixelate': '00_core.ipynb', 'find_faces': '00_core.ipynb', 'blur_areas': '00_core.ipynb', 'anonymize': '00_core.ipynb', 'load_img': '00_core.ipynb', 'path': '00_core.ipynb', 'get_image_download_...
## class SoSAutomator: def __init__(): pass def setActivity(activity): pass def selectPlayer(): pass
class Sosautomator: def __init__(): pass def set_activity(activity): pass def select_player(): pass
# for i in range(11037): # print("R"+str(i)) if __name__ == '__main__': count_line = 24992; list_source = "'events'" cell_orig = "C" cell_transl = "D" flag_concat_origin = "Eo-" flag_concat_transl = "Et-" for i in range(count_line): # print("E" + str(i)) print(r"=if(len(...
if __name__ == '__main__': count_line = 24992 list_source = "'events'" cell_orig = 'C' cell_transl = 'D' flag_concat_origin = 'Eo-' flag_concat_transl = 'Et-' for i in range(count_line): print('=if(len(' + list_source + '!' + cell_transl + str(i) + ') > 0;' + 'CONCAT("' + flag_concat...
n = int(input()) s = 0 while s < n: current_num = int(input()) s += current_num print(s)
n = int(input()) s = 0 while s < n: current_num = int(input()) s += current_num print(s)
#demo of class MyClass class MyClass: def __init__(self,name,age): self.name=name self.age=age self.skills=["Java","JavaScript","Python"] def display(self): print("name:"+self.name) print("age:"+self.age) print("skills:") for s in self.skills: ...
class Myclass: def __init__(self, name, age): self.name = name self.age = age self.skills = ['Java', 'JavaScript', 'Python'] def display(self): print('name:' + self.name) print('age:' + self.age) print('skills:') for s in self.skills: print(s...
#!/usr/bin/python with open('words.txt') as f: lines = f.readlines() for line in lines: print(line.rstrip())
with open('words.txt') as f: lines = f.readlines() for line in lines: print(line.rstrip())
characterMapEliza = { "eliza_be0_full_naked_002": "eliza_be0_full_naked_002", # Auto: Same "eliza_be0_full_under_002": "eliza_be0_full_under_002", # Auto: Same "eliza_be0_naked_002": "eliza_be0_naked_002", # Auto: Same "eliz...
character_map_eliza = {'eliza_be0_full_naked_002': 'eliza_be0_full_naked_002', 'eliza_be0_full_under_002': 'eliza_be0_full_under_002', 'eliza_be0_naked_002': 'eliza_be0_naked_002', 'eliza_be0_under_002': 'eliza_be0_under_002', 'eliza_be1_001': 'eliza_be1_001', 'eliza_be1_002': 'eliza_be1_002', 'eliza_be1_003': 'eliza_b...
def func(): print("Func() In ONE.py") def func1(): pass print("Top Level in one py") if __name__ == '__main__': #RUN the script print('one.py is running directly') func1() else: print('one.py has be imported')
def func(): print('Func() In ONE.py') def func1(): pass print('Top Level in one py') if __name__ == '__main__': print('one.py is running directly') func1() else: print('one.py has be imported')
class Logger(object): def __init__(self): self.dic = {} def shouldPrintMessage(self, timestamp, message): if message not in self.dic: self.dic[message] = timestamp return True else: if timestamp - self.dic[message] > 10: self.dic[messa...
class Logger(object): def __init__(self): self.dic = {} def should_print_message(self, timestamp, message): if message not in self.dic: self.dic[message] = timestamp return True elif timestamp - self.dic[message] > 10: self.dic[message] = timestamp ...
__author__ = 'ipetrash' def create_massive(rows, cols, init_value): return [[init_value for c in range(cols)] for r in range(rows)] def create_massive_2(rows, cols, init_value): massive = [] for r in range(rows): massive.append([]) for c in range(cols): massive[r].append(ini...
__author__ = 'ipetrash' def create_massive(rows, cols, init_value): return [[init_value for c in range(cols)] for r in range(rows)] def create_massive_2(rows, cols, init_value): massive = [] for r in range(rows): massive.append([]) for c in range(cols): massive[r].append(init_v...
def solution(): x, y, *rival = input().split() medal = 2 medal -= 1 if x in rival else 0 medal -= 1 if y in rival else 0 print(medal) test_case = int(input()) while test_case: solution() test_case -= 1
def solution(): (x, y, *rival) = input().split() medal = 2 medal -= 1 if x in rival else 0 medal -= 1 if y in rival else 0 print(medal) test_case = int(input()) while test_case: solution() test_case -= 1
class CCXTException: def __init__(self, exceptionType, message): self.exceptionType = exceptionType self.message = message
class Ccxtexception: def __init__(self, exceptionType, message): self.exceptionType = exceptionType self.message = message
# 80. Remove Duplicates from Sorted Array II # Time: O(len(nums)) # Space: O(1) class Solution: def removeDuplicates(self, nums: List[int]) -> int: start = 0 index = 0 while index<len(nums): if start<2 or (nums[index]!=nums[start-1] or nums[index]!=nums[start-2]): ...
class Solution: def remove_duplicates(self, nums: List[int]) -> int: start = 0 index = 0 while index < len(nums): if start < 2 or (nums[index] != nums[start - 1] or nums[index] != nums[start - 2]): nums[start] = nums[index] start += 1 ...
class Traverser(object): def __init__(self): pass def addVisitor(self,visitor): pass def visitEvent(self,event,data): pass def traverseForest(self,CFGForest): pass def traverseFunc(self,funcName): pass def traverseBlock(self,CFG,blockId,forestKey,prev...
class Traverser(object): def __init__(self): pass def add_visitor(self, visitor): pass def visit_event(self, event, data): pass def traverse_forest(self, CFGForest): pass def traverse_func(self, funcName): pass def traverse_block(self, CFG, blockId, ...
def find_all(sd, d): if sd/d > 9: return [] res, ln = [], 0 for i in partitions(sd): if filter(lambda x: len(str(x))>1, i): break if len(i)==d and sum(i) == sd: res.append(int(''.join(map(str,i)))) ln +=1 return [ln, res[-1], res[0]] if r...
def find_all(sd, d): if sd / d > 9: return [] (res, ln) = ([], 0) for i in partitions(sd): if filter(lambda x: len(str(x)) > 1, i): break if len(i) == d and sum(i) == sd: res.append(int(''.join(map(str, i)))) ln += 1 return [ln, res[-1], res[0]...
class PFSSurvey: z_samples = { 0: { "zrange": [0.7, 1.0], "max_dict": dict(m_y=22.5, m_j=22.8) }, 1: { "zrange": [1.0, 1.7], "max_dict": dict(m_j=22.8) } } sqdeg = 12.0 completeness = 0.7 def __init__(self, z_sample): ...
class Pfssurvey: z_samples = {0: {'zrange': [0.7, 1.0], 'max_dict': dict(m_y=22.5, m_j=22.8)}, 1: {'zrange': [1.0, 1.7], 'max_dict': dict(m_j=22.8)}} sqdeg = 12.0 completeness = 0.7 def __init__(self, z_sample): self.zrange = self.z_samples[z_sample]['zrange'] self.max_dict = self.z_sam...
tests = [["a"],["b"],["c"]] for i, t in enumerate(tests[2:]): print(i) tests[i] = list(filter(lambda x: x is "b", t)) print(tests)
tests = [['a'], ['b'], ['c']] for (i, t) in enumerate(tests[2:]): print(i) tests[i] = list(filter(lambda x: x is 'b', t)) print(tests)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Modul : rwn_steuerung.py # Version : 1.00 # SW-Stand : 18.04.2021 # Autor : Rolf Weiss # Beschreibung : Definition von Steuerungs-Sequenzen # Cursor-Position, Farben und Tastencodes class position: up = '\r\033[A' d...
class Position: up = '\r\x1b[A' down = '\r\x1b[B' right = '\x1b[C' left = '\x1b[D' class Color: reset = '\x1b[0m' black = '\x1b[30m' red = '\x1b[31m' green = '\x1b[32m' orange = '\x1b[33m' blue = '\x1b[34m' purple = '\x1b[35m' pink = '\x1b[95m' cyan = '\x1b[36m' ...
# # PySNMP MIB module QUANTA-BGP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/QUANTA-BGP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:35:45 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, value_size_constraint, constraints_union, constraints_intersection) ...
class Solution: def backspaceCompare(self, s: str, t: str) -> bool: s2 = "" t2 = "" for each in s: if each=="#": s2 = s2[:-1] else: s2+=each for each in t: if each=="#": t2 = t2[:-1] else:...
class Solution: def backspace_compare(self, s: str, t: str) -> bool: s2 = '' t2 = '' for each in s: if each == '#': s2 = s2[:-1] else: s2 += each for each in t: if each == '#': t2 = t2[:-1] ...
def add(arr): assert len(arr) == 2 sum = 0 for i in arr: sum += i return sum def multipy(arr): assert len(arr) == 2 mul = 1 for i in arr: mul *= i return mul def devide(arr): assert len(arr) == 2 if arr[1] == 0: return arr[0] return arr[0] / arr[1]...
def add(arr): assert len(arr) == 2 sum = 0 for i in arr: sum += i return sum def multipy(arr): assert len(arr) == 2 mul = 1 for i in arr: mul *= i return mul def devide(arr): assert len(arr) == 2 if arr[1] == 0: return arr[0] return arr[0] / arr[1] ...
#!/usr/bin/env python def index(): return {}
def index(): return {}
INF = 10 ** 9 def BellmanFord(s): dist = [INF] * (n + 1) dist[s] = 0 for i in range(n): for edge in graph: u, v, w = edge if dist[u] != INF and dist[u] + w < dist[v]: dist[v] = dist[u] + w if i == n - 1: #!!! return True return False T...
inf = 10 ** 9 def bellman_ford(s): dist = [INF] * (n + 1) dist[s] = 0 for i in range(n): for edge in graph: (u, v, w) = edge if dist[u] != INF and dist[u] + w < dist[v]: dist[v] = dist[u] + w if i == n - 1: return True ...
numbers_list = list(map(lambda x: float(x), input().split(' '))) occ_dic = {num: numbers_list.count(num) for num in numbers_list} #now is sorted by values, default is by key for key, value in sorted(occ_dic.items(), key=lambda kvp: kvp[1], reverse=True): print(f'{key} -> {value} times')
numbers_list = list(map(lambda x: float(x), input().split(' '))) occ_dic = {num: numbers_list.count(num) for num in numbers_list} for (key, value) in sorted(occ_dic.items(), key=lambda kvp: kvp[1], reverse=True): print(f'{key} -> {value} times')
def part1(): count = 0 with open('day1-input.txt') as f: lines = [int(x) for x in f.readlines()] for index, current_depth in enumerate(lines[1:]): previous_depth = lines[index] if current_depth > previous_depth: count += 1 print(f"The measurement incre...
def part1(): count = 0 with open('day1-input.txt') as f: lines = [int(x) for x in f.readlines()] for (index, current_depth) in enumerate(lines[1:]): previous_depth = lines[index] if current_depth > previous_depth: count += 1 print(f'The measurement inc...
class AttrMapping: def __init__(self, dataset_name, mapping_type='integer', node_attr_dims=None, edge_attr_dims=None): self.node_attr_dims = node_attr_dims self.edge_attr_dims = edge_attr_dims if dataset_name == 'MUTAG': self.node_attr_values = [['C', 'N', 'O', 'F', 'I', 'Cl', 'B...
class Attrmapping: def __init__(self, dataset_name, mapping_type='integer', node_attr_dims=None, edge_attr_dims=None): self.node_attr_dims = node_attr_dims self.edge_attr_dims = edge_attr_dims if dataset_name == 'MUTAG': self.node_attr_values = [['C', 'N', 'O', 'F', 'I', 'Cl', '...
# Print "Hello" if a is equal to b, or if c is equal to d. a, b, c, d = 1, 1, 1, 1 if a == b or c == d: print("Hello")
(a, b, c, d) = (1, 1, 1, 1) if a == b or c == d: print('Hello')
caves = {} while True: try: (a, b) = input().split("-") if a in caves: cave_a = caves[a] cave_a.append(b) else: cave_a = [b] caves[a] = cave_a if b in caves: cave_b = caves[b] cave_b.append(a) else: ...
caves = {} while True: try: (a, b) = input().split('-') if a in caves: cave_a = caves[a] cave_a.append(b) else: cave_a = [b] caves[a] = cave_a if b in caves: cave_b = caves[b] cave_b.append(a) else: ...
# Copyright (c) 2011 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. # There's a couple key GYP variables that control how FFmpeg is built: # ffmpeg_branding # Controls whether we build the Chromium or Google Chrome ...
{'target_defaults': {'variables': {'release_optimize': '2', 'debug_optimize': '2', 'mac_debug_optimization': '2', 'win_debug_Optimization': '2', 'win_debug_RuntimeChecks': '0'}}, 'variables': {'conditions': [['target_arch == "arm" and armv7 == 1 and arm_neon == 1', {'ffmpeg_config%': 'arm-neon'}, {'ffmpeg_config%': '<(...
s = input() d={"UPPER CASE":0, "LOWER CASE":0} for c in s: if c.isupper(): d["UPPER CASE"]+=1 elif c.islower(): d["LOWER CASE"]+=1 else: pass print("UPPER CASE", d["UPPER CASE"]) print("LOWER CASE", d["LOWER CASE"])
s = input() d = {'UPPER CASE': 0, 'LOWER CASE': 0} for c in s: if c.isupper(): d['UPPER CASE'] += 1 elif c.islower(): d['LOWER CASE'] += 1 else: pass print('UPPER CASE', d['UPPER CASE']) print('LOWER CASE', d['LOWER CASE'])
#!/usr/bin/env python3 x = int(input("Enter number ")) i = 1 while(True): if(x // (10 ** i) == 0): dig = i break i += 1 lis = [] for i in str(x): lis.append(int(i)) i = 0 arm = 0 while(i < len(lis)): arm += lis[i] ** dig i += 1 if(arm == x): print("It is Armstrong number") else: ...
x = int(input('Enter number ')) i = 1 while True: if x // 10 ** i == 0: dig = i break i += 1 lis = [] for i in str(x): lis.append(int(i)) i = 0 arm = 0 while i < len(lis): arm += lis[i] ** dig i += 1 if arm == x: print('It is Armstrong number') else: print('It is not Armstron...
controller_actions = { 'charging_temperature': {'lower': 'Battery Warming System Activated', 'upper': 'Battery Cooling System Activated'}, 'state_of_charge': {'lower': 'Stopping Charging: Low Battery', 'upper': 'Stopping Charging: Battery Almost Full'}, 'charge_rate': {'lower': 'Stopping Charging: Charge ra...
controller_actions = {'charging_temperature': {'lower': 'Battery Warming System Activated', 'upper': 'Battery Cooling System Activated'}, 'state_of_charge': {'lower': 'Stopping Charging: Low Battery', 'upper': 'Stopping Charging: Battery Almost Full'}, 'charge_rate': {'lower': 'Stopping Charging: Charge rate low', 'upp...
BASE_DIR = "/faceEditor/" TEMP_DIR = "temp/" THUMBNAIL_SIZE = 256, 256 # MODEL MODEL = "MODELS/generator_8.h5" MODEL_SIZE_SGM = 512, 512 MODEL_SIZE_ORG = 512, 512 SAVE_DATA = True
base_dir = '/faceEditor/' temp_dir = 'temp/' thumbnail_size = (256, 256) model = 'MODELS/generator_8.h5' model_size_sgm = (512, 512) model_size_org = (512, 512) save_data = True
class swagger_path(object): def __init__(self, swagger_file): self.swagger_file = swagger_file def __call__(self, f): f.swagger_file = self.swagger_file return f
class Swagger_Path(object): def __init__(self, swagger_file): self.swagger_file = swagger_file def __call__(self, f): f.swagger_file = self.swagger_file return f
my_list = [1,2,3,4,5] for each in my_list: #iterating over the defined list print(each)
my_list = [1, 2, 3, 4, 5] for each in my_list: print(each)
# -*- coding: utf-8 -*- # @Time : 2019/12/30 11:38 # @Author : Tonny Cao # @Email : 647812411@qq.com # @File : __init__.py # @Software: PyCharm __version__ = 0.1
__version__ = 0.1
MAGICSTR_BYTES = b'pst0' STORABLE_BIN_MAJOR = 2 # Binary major "version" STORABLE_BIN_MINOR = 11 # Binary minor "version" BYTEORDER_BYTES = b'12345678' SIZE_OF_INT = 4 SIZE_OF_LONG = 8 SIZE_OF_CHAR_PTR = 8 SIZE_OF_NV = 8 LG_BLESS = 127 # Large classname bless limit #define svis_REF 0 # svis_SCALAR = 1 #define s...
magicstr_bytes = b'pst0' storable_bin_major = 2 storable_bin_minor = 11 byteorder_bytes = b'12345678' size_of_int = 4 size_of_long = 8 size_of_char_ptr = 8 size_of_nv = 8 lg_bless = 127 shv_restricted = 1 shv_k_utf8 = 1 shv_k_wasutf8 = 2 shv_k_locked = 4 shv_k_issv = 8 sx_object = 0 sx_lscalar = 1 sx_array = 2 sx_hash ...
# self-scare l = 6 def setup(): size(527, 700) global img img=loadImage("face.png") def draw(): background(255) translate(width/2, height/2) emoji(527, 700, 1) def emoji( w, h, level): global l t=map(level, 1, l, 255, 80) tint(t) imageMode(CENTER) image(img, 0,...
l = 6 def setup(): size(527, 700) global img img = load_image('face.png') def draw(): background(255) translate(width / 2, height / 2) emoji(527, 700, 1) def emoji(w, h, level): global l t = map(level, 1, l, 255, 80) tint(t) image_mode(CENTER) image(img, 0, 0, w, h) if...
class CompilationConfig: def __init__(self, sourceCode, # str for single code / dict for several files { file_name : source_code } language: str, compileTimeLimit: int ): self.sourceCode = sourceCode self.language = language ...
class Compilationconfig: def __init__(self, sourceCode, language: str, compileTimeLimit: int): self.sourceCode = sourceCode self.language = language self.compileTimeLimit = compileTimeLimit class Testpointconfig: def __init__(self, programPath: str, userOutputFile, inputFile: str, tim...
# # PySNMP MIB module HPN-ICF-LAG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-LAG-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:39:36 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, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, constraints_union, constraints_intersection, value_size_constraint) ...
def first(n): return n[0] def sort_list_first(tuples): return sorted(tuples, key=first) print(sort_list_first([(5, 2), (2, 1), (4, 4), (3, 2), (1, 2)]))
def first(n): return n[0] def sort_list_first(tuples): return sorted(tuples, key=first) print(sort_list_first([(5, 2), (2, 1), (4, 4), (3, 2), (1, 2)]))
stations = { "07005": {"departement": "80"}, "07015": {"departement": "59"}, "07020": {"departement": "50"}, "07027": {"departement": "14"}, "07037": {"departement": "76"}, "07072": {"departement": "51"}, "07110": {"departement": "29"}, "07117": {"departement": "22"}, "07130": {"depa...
stations = {'07005': {'departement': '80'}, '07015': {'departement': '59'}, '07020': {'departement': '50'}, '07027': {'departement': '14'}, '07037': {'departement': '76'}, '07072': {'departement': '51'}, '07110': {'departement': '29'}, '07117': {'departement': '22'}, '07130': {'departement': '35'}, '07139': {'departeme...
access_codes = { "axc123": { "reference_unit_id": "123", "reference_unit_name": "ACME Corporation", "survey_id": "023", "survey_name": "Monthly Commodities Enquiry", "form_type_id": "0231", "survey_period": "0616" }, "dey789": { "reference_unit_id": "...
access_codes = {'axc123': {'reference_unit_id': '123', 'reference_unit_name': 'ACME Corporation', 'survey_id': '023', 'survey_name': 'Monthly Commodities Enquiry', 'form_type_id': '0231', 'survey_period': '0616'}, 'dey789': {'reference_unit_id': '124', 'reference_unit_name': 'Methods Digital', 'survey_id': '023', 'surv...
''' https://leetcode.com/problems/longest-increasing-subsequence/ ''' class Solution: def lengthOfLIS(self, nums: List[int]) -> int: n = len(nums) graph=[ [] for i in range(n)] for i in range(n): for j in range(i+1,n): if nums[j]>nums[i]: graph...
""" https://leetcode.com/problems/longest-increasing-subsequence/ """ class Solution: def length_of_lis(self, nums: List[int]) -> int: n = len(nums) graph = [[] for i in range(n)] for i in range(n): for j in range(i + 1, n): if nums[j] > nums[i]: ...
name = 'Zed A. Shaw' age = 35 # not a lie height = 74.0 # inches weight = 180.0 # lbs eyes = 'Blue' teeth = 'White' hair = 'Brown' centimeters = height * 2.54 kilograms = weight * 0.45359237 print(f"Let's talk about {name}.") print(f"He's {centimeters} centimeters tall.") print(f"He's {kilograms} kilograms heavy....
name = 'Zed A. Shaw' age = 35 height = 74.0 weight = 180.0 eyes = 'Blue' teeth = 'White' hair = 'Brown' centimeters = height * 2.54 kilograms = weight * 0.45359237 print(f"Let's talk about {name}.") print(f"He's {centimeters} centimeters tall.") print(f"He's {kilograms} kilograms heavy.") print("Actually that's not too...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"ImgSize": "00_core.ipynb", "ImgLayout": "00_core.ipynb", "ImgType": "00_core.ipynb", "ImgColor": "00_core.ipynb", "duckduckgo_scrape_urls": "00_core.ipynb", "rmtr...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'ImgSize': '00_core.ipynb', 'ImgLayout': '00_core.ipynb', 'ImgType': '00_core.ipynb', 'ImgColor': '00_core.ipynb', 'duckduckgo_scrape_urls': '00_core.ipynb', 'rmtree': '00_core.ipynb', 'download_urls': '00_core.ipynb', 'duckduckgo_search': '00_core....
CONFIG = { "markers": [ { # Deadline is 04/22/2022 @ 11:59pm, but use 04/23/2022 @ 12am # since it'll look nicer 'd': ['2022-04-23'], 't': 0, 'l': 'solid', 'c': '#ad0be3', 'n': 'Drop (No W) Deadline', 's': False ...
config = {'markers': [{'d': ['2022-04-23'], 't': 0, 'l': 'solid', 'c': '#ad0be3', 'n': 'Drop (No W) Deadline', 's': False}, {'d': ['2022-05-07'], 't': 0, 'l': 'solid', 'c': '#20c2d4', 'n': 'Drop (W) Deadline', 's': False}], 'settings': {'termName': 'Spring 2022 Post-Enrollment', 'isNormal': False, 'showTotal': False, '...
def print_output(taskbook): output = taskbook['output'] #pprint(output) # Print task results print(f"Task = {output['task']}") for result in sorted(output['devices'], key=lambda k: k['device']): print('='*20,f"Results for {result['device']}",'='*20) if 'exception' not in...
def print_output(taskbook): output = taskbook['output'] print(f"Task = {output['task']}") for result in sorted(output['devices'], key=lambda k: k['device']): print('=' * 20, f"Results for {result['device']}", '=' * 20) if 'exception' not in result: if isinstance(result['result'],...
with open(r'2021/day_1/SonarSweepInput.txt', 'r') as sonar_data: depths = [int(depth.strip()) for depth in sonar_data.readlines()] window_sums = [sum(depths[i:i+3]) for i in range(len(depths))] counter = 0 for i, depth in enumerate(window_sums): if int(depth) > int(window_sums[i-1]): counter ...
with open('2021/day_1/SonarSweepInput.txt', 'r') as sonar_data: depths = [int(depth.strip()) for depth in sonar_data.readlines()] window_sums = [sum(depths[i:i + 3]) for i in range(len(depths))] counter = 0 for (i, depth) in enumerate(window_sums): if int(depth) > int(window_sums[i - 1]): counter +=...
def greet_person(name): print("Hello " + name) personExample = { "name": "Sandip", "age": 20, "country": "India" }
def greet_person(name): print('Hello ' + name) person_example = {'name': 'Sandip', 'age': 20, 'country': 'India'}
log_level = "DEBUG" input_ip = "0.0.0.0" input_port = 8125 output_ip = "0.0.0.0" output_ports = [8126,8127]
log_level = 'DEBUG' input_ip = '0.0.0.0' input_port = 8125 output_ip = '0.0.0.0' output_ports = [8126, 8127]
ANCHOR_INFO_PATH = "C:/Users/sangmin/Desktop/backbone/pytorch/detection/dataset_info/yolo_anchors.txt" TRAIN_DIR_PATH = "C:/Users/sangmin/Desktop/backbone/dataset/coco/train2017" VALID_DIR_PATH = "C:/Users/sangmin/Desktop/backbone/dataset/coco/val2017" backbone_name = "Regnet-yolo" input_shape = (3, 608, 608) batch_si...
anchor_info_path = 'C:/Users/sangmin/Desktop/backbone/pytorch/detection/dataset_info/yolo_anchors.txt' train_dir_path = 'C:/Users/sangmin/Desktop/backbone/dataset/coco/train2017' valid_dir_path = 'C:/Users/sangmin/Desktop/backbone/dataset/coco/val2017' backbone_name = 'Regnet-yolo' input_shape = (3, 608, 608) batch_siz...
width , height = 900 , 500 WIN = pygame.display.set_mode(( width , height)) pygame.display.set_caption(" Space Game!!") bullet_firesound = pygame.mixer.Sound('python\PygameForBeginners-main\Assets\Gun+Silencer.mp3') bullet_hitsound = pygame.mixer.Sound('python\PygameForBeginners-main\Assets\Grenade+1.mp3') health_...
(width, height) = (900, 500) win = pygame.display.set_mode((width, height)) pygame.display.set_caption(' Space Game!!') bullet_firesound = pygame.mixer.Sound('python\\PygameForBeginners-main\\Assets\\Gun+Silencer.mp3') bullet_hitsound = pygame.mixer.Sound('python\\PygameForBeginners-main\\Assets\\Grenade+1.mp3') health...
class Solution: def minSubsequence(self, nums: List[int]) -> List[int]: if len(nums) == 1: return nums nums = sorted(nums, reverse = True); i = 1 while i < len(nums): if sum(nums[:i]) > sum(nums[i:]): return nums[:i] i += 1 return nums
class Solution: def min_subsequence(self, nums: List[int]) -> List[int]: if len(nums) == 1: return nums nums = sorted(nums, reverse=True) i = 1 while i < len(nums): if sum(nums[:i]) > sum(nums[i:]): return nums[:i] i += 1 r...
n = int(input()) if n % 2 == 0: print(str(n) + ' is even!') else: print(str(n) + ' is odd!')
n = int(input()) if n % 2 == 0: print(str(n) + ' is even!') else: print(str(n) + ' is odd!')
# def order(): # return 1 def filter(x): print("filter called") print(x) def detect(x): x = ''.join([chr(l) for l in x[:3]]) if x == 'SSH': return True return False
def filter(x): print('filter called') print(x) def detect(x): x = ''.join([chr(l) for l in x[:3]]) if x == 'SSH': return True return False
# -*- coding: utf-8 -*- description = 'ANTARES shutter devices' group = 'lowlevel' devices = dict( shutter1 = device('nicos.devices.generic.ManualSwitch', description = 'Shutter 1', states = ['open', 'closed'], ), shutter2 = device('nicos.devices.generic.ManualSwitch', description ...
description = 'ANTARES shutter devices' group = 'lowlevel' devices = dict(shutter1=device('nicos.devices.generic.ManualSwitch', description='Shutter 1', states=['open', 'closed']), shutter2=device('nicos.devices.generic.ManualSwitch', description='Shutter 2', states=['open', 'closed']), fastshutter=device('nicos.device...
n, k = map(int, input().split()) height = map(int, input().split()) jump = max(height) - k if jump >= 0: print(jump) else: print(0)
(n, k) = map(int, input().split()) height = map(int, input().split()) jump = max(height) - k if jump >= 0: print(jump) else: print(0)
# -*- coding: utf-8 -*- # Default data types INT = 'int64' FLOAT = 'float32' MODEL_DEFAULTS = { 'weight_init': 'xavier', # Can be a float for the scale of normal initialization, "xavier" or "he". 'batch_size': 32, # Training batch size 'optimizer': '...
int = 'int64' float = 'float32' model_defaults = {'weight_init': 'xavier', 'batch_size': 32, 'optimizer': 'adam', 'lrate': None} train_defaults = {'init': None, 'device_id': 'auto', 'seed': 1234, 'clip_c': 5.0, 'decay_c': 0.0, 'patience': 10, 'patience_delta': 0.0, 'max_epochs': 100, 'max_iteration': int(1000000.0), 'v...
def local_minima(left,right,array): ''' Function to calculate local minima using binary search technique ''' mid = (left+right)//2 if (mid == 0 or array[mid]<array[mid-1] and mid == len(array)-1 or array[mid]<array[mid+1]): return array[mid] elif (mid > 0 and array[mid]>array[mid-1]): right = mid-1 ...
def local_minima(left, right, array): """ Function to calculate local minima using binary search technique """ mid = (left + right) // 2 if mid == 0 or (array[mid] < array[mid - 1] and mid == len(array) - 1) or array[mid] < array[mid + 1]: return array[mid] elif mid > 0 and array[mid] > arra...
class BasicField: def __init__(self, field): self.column = field[1:] def get_value(self, row): return row[self.column].replace('\n', '').replace('\r', '')
class Basicfield: def __init__(self, field): self.column = field[1:] def get_value(self, row): return row[self.column].replace('\n', '').replace('\r', '')
#!/usr/bin/python # ex:set fileencoding=utf-8: ''' from __future__ import unicode_literals from django.forms.models import ModelChoiceIterator as DjangoModelChoiceIterator from django.forms.models import ModelChoiceField as DjangoModelChoiceField class ModelChoiceIterator(DjangoModelChoiceIterator): def __ite...
""" from __future__ import unicode_literals from django.forms.models import ModelChoiceIterator as DjangoModelChoiceIterator from django.forms.models import ModelChoiceField as DjangoModelChoiceField class ModelChoiceIterator(DjangoModelChoiceIterator): def __iter__(self): if self.field.empty_label is ...
class Solution: def depthSumInverse(self, nestedList: List[NestedInteger]) -> int: level_col = collections.defaultdict(list) def count( nest, level ): if nest.isInteger(): level_col[level].append(nest.getInteger()) for n in nest....
class Solution: def depth_sum_inverse(self, nestedList: List[NestedInteger]) -> int: level_col = collections.defaultdict(list) def count(nest, level): if nest.isInteger(): level_col[level].append(nest.getInteger()) for n in nest.getList(): co...
def read_file_word(file_name): with open(file_name, "r") as file_obj: words = file_obj.read().split() return words
def read_file_word(file_name): with open(file_name, 'r') as file_obj: words = file_obj.read().split() return words
class Solution: def minInsertions(self, s: str) -> int: m=len(s) # Calculating the length of the string t=[[0 for i in range(m+1)] for i in range(m+1)] r=s[::-1] # Reversing the string for i in range(1,m+1): for j in range(1,m+1): ...
class Solution: def min_insertions(self, s: str) -> int: m = len(s) t = [[0 for i in range(m + 1)] for i in range(m + 1)] r = s[::-1] for i in range(1, m + 1): for j in range(1, m + 1): if m == 0: t[i][j] = 0 elif s[i -...
def isIn(char, aStr): ''' char: a single character aStr: an alphabetized string returns: True if char is in aStr; False otherwise ''' # Your code here l = len(aStr) if l==0 and char=='': return True elif l==0 and char!='': return False if l%2 == 0: ...
def is_in(char, aStr): """ char: a single character aStr: an alphabetized string returns: True if char is in aStr; False otherwise """ l = len(aStr) if l == 0 and char == '': return True elif l == 0 and char != '': return False if l % 2 == 0: n = l // 2 ...
#BFS solution class Solution(object): def levelOrder(self, root): q, ret = [root], [] while any(q): ret.append([node.val for node in q]) q = [child for node in q for child in node.children if child] return ret
class Solution(object): def level_order(self, root): (q, ret) = ([root], []) while any(q): ret.append([node.val for node in q]) q = [child for node in q for child in node.children if child] return ret
# all programming lanuages include selector (if statments) def main(num): if num < 5: print("num is less then 5") # if else statement def main2(num): if num < 5 : print("num is less then 5") else: print("num is greater then 5") # if elif statment def main3(num): if num == 5 : ...
def main(num): if num < 5: print('num is less then 5') def main2(num): if num < 5: print('num is less then 5') else: print('num is greater then 5') def main3(num): if num == 5: print('num is 5') elif num < 5: print('num is less then 5') else: pri...
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # project = u'EveryVoter' author = u'Nick Catalano' extensions = [ 'sphinxcontrib.images', "sphinx_rtd_theme", ] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' language = None exclude_patterns = ...
project = u'EveryVoter' author = u'Nick Catalano' extensions = ['sphinxcontrib.images', 'sphinx_rtd_theme'] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' language = None exclude_patterns = [] pygments_style = 'sphinx' html_theme = 'sphinx_rtd_theme' html_theme_options = {'titles_only': Fal...
# File: hackertarget_consts.py # # Copyright (c) 2016-2022 Splunk Inc. # # 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 b...
err_connectivity_test = 'Connectivity test failed' succ_connectivity_test = 'Connectivity test passed' err_404_msg = 'Requested resource not found' err_server_connection = 'Connection failed' err_from_server = 'API failed, Status code: {status}, Detail: {detail}' err_api_unsupported_method = 'Unsupported method' using_...
_base_ = './htc_without_semantic_r50_fpn_1x_coco.py' model = dict( pretrained='open-mmlab://resnext101_64x4d', backbone=dict( type='ResNeXt', depth=101, groups=64, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict...
_base_ = './htc_without_semantic_r50_fpn_1x_coco.py' model = dict(pretrained='open-mmlab://resnext101_64x4d', backbone=dict(type='ResNeXt', depth=101, groups=64, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='pytorch', dcn=dict...
class BufferUnderflowException(Exception): pass class BoundBuffer(object): buff = b'' cursor = 0 def __init__(self, data=b""): self.write(data) def read(self, length): if length > len(self): raise BufferUnderflowException() out = self.buff[self.cursor:self.cu...
class Bufferunderflowexception(Exception): pass class Boundbuffer(object): buff = b'' cursor = 0 def __init__(self, data=b''): self.write(data) def read(self, length): if length > len(self): raise buffer_underflow_exception() out = self.buff[self.cursor:self.cu...
GUIDE_NAME = 'plum' class Plum(object): def __init__(self, glyph): self.glyph = glyph def toggle(self): if self.plum_guide: self.destroy() else: self.create() def create(self): if self.glyph_exists: self.glyph.addGuide(self.position, s...
guide_name = 'plum' class Plum(object): def __init__(self, glyph): self.glyph = glyph def toggle(self): if self.plum_guide: self.destroy() else: self.create() def create(self): if self.glyph_exists: self.glyph.addGuide(self.position, se...
class Lukuvinkki: def __init__(self, otsikko, url): self.otsikko = otsikko self.url = url def get_otsikko(self): return self.otsikko def get_linkki(self): return self.url def __str__(self): return f"Otsikko: {self.otsikko} \n Url: {self.url} "
class Lukuvinkki: def __init__(self, otsikko, url): self.otsikko = otsikko self.url = url def get_otsikko(self): return self.otsikko def get_linkki(self): return self.url def __str__(self): return f'Otsikko: {self.otsikko} \n Url: {self.url} '
def make_readable(seconds: int): if seconds <= 359999: hours = seconds // (60*60) minutes = seconds % (60*60) // 60 seconds = seconds % 60 return '{:02}:{:02}:{:02}'.format(hours, minutes, seconds) else: return "99:59:59" print(make_readable(5)) print(make_readable(3500...
def make_readable(seconds: int): if seconds <= 359999: hours = seconds // (60 * 60) minutes = seconds % (60 * 60) // 60 seconds = seconds % 60 return '{:02}:{:02}:{:02}'.format(hours, minutes, seconds) else: return '99:59:59' print(make_readable(5)) print(make_readable(35...
def load_bpi(): with open("bpi-rte.txt", "r") as f: content = f.read() pairs = content.split("\n\n") pairs_done = {"YES": list(), "NO": list()} for pair in pairs: try: text, hypothesis, entailment = pair.split("\n") except ValueError: # last pair ...
def load_bpi(): with open('bpi-rte.txt', 'r') as f: content = f.read() pairs = content.split('\n\n') pairs_done = {'YES': list(), 'NO': list()} for pair in pairs: try: (text, hypothesis, entailment) = pair.split('\n') except ValueError: (text, hypothesis, ...
#!/usr/local/bin/python # Code Fights Is Sum Consecutive 2 Problem def isSumConsecutive2(n): count = 0 nums = list(range(1, n)) for i in range(len(nums)): for j in range(i + 1, len(nums)): tmp = sum(nums[i:j]) if tmp == n: count += 1 if tmp > n: ...
def is_sum_consecutive2(n): count = 0 nums = list(range(1, n)) for i in range(len(nums)): for j in range(i + 1, len(nums)): tmp = sum(nums[i:j]) if tmp == n: count += 1 if tmp > n: break return count def main(): tests = [[1...
P = 10**9 + 7 class MODCombination: def __init__(self, n, p): self.n = n self.p = p # MOD self.fac, self.ifac = self.make_fac_tables_mod_p(n, p) @staticmethod def make_fac_tables_mod_p(n, p): assert n >= 1 fac = [0] * (n + 1) # _______ factorial: n! ifac...
p = 10 ** 9 + 7 class Modcombination: def __init__(self, n, p): self.n = n self.p = p (self.fac, self.ifac) = self.make_fac_tables_mod_p(n, p) @staticmethod def make_fac_tables_mod_p(n, p): assert n >= 1 fac = [0] * (n + 1) ifac = [0] * (n + 1) inv ...
#!/usr/bin/env python # -*- coding: UTF-8 -*- class global_var: getpriv = False newUser = "" targetName = "" newPassword = "" ccache = "" dcsync = False def set_dcsync(status): global_var.dcsync = status def get_dcsync(): return global_var.dcsync def set_priv(status): global_var...
class Global_Var: getpriv = False new_user = '' target_name = '' new_password = '' ccache = '' dcsync = False def set_dcsync(status): global_var.dcsync = status def get_dcsync(): return global_var.dcsync def set_priv(status): global_var.getpriv = status def get_priv(): return...
def CANDLE_TO_INFLUXDB_JSON(coinbase_product, candle): return [ { "measurement": coinbase_product, "time": int(candle[0]), "fields": { "low": float(candle[1]), "high": float(candle[2]), "open": float(candle[3]), ...
def candle_to_influxdb_json(coinbase_product, candle): return [{'measurement': coinbase_product, 'time': int(candle[0]), 'fields': {'low': float(candle[1]), 'high': float(candle[2]), 'open': float(candle[3]), 'close': float(candle[4]), 'volume': float(candle[5])}}]
class Rectangle: def __init__(self, l, w): self.length = l self.width = w def area(self): return self.length*self.width aRectangle = Rectangle(2,10) print(aRectangle.area())
class Rectangle: def __init__(self, l, w): self.length = l self.width = w def area(self): return self.length * self.width a_rectangle = rectangle(2, 10) print(aRectangle.area())
PuzzleInput = "PuzzleInput.txt" f = open(PuzzleInput) txt = f.readlines() seatID = 0 for i in txt: binary = i.replace("F", "0") binary = binary.replace("B", "1") binary = binary.replace("L", "0") binary = binary.replace("R", "1") row = int(binary[:7],2) seat = int(binary[7:],2) i...
puzzle_input = 'PuzzleInput.txt' f = open(PuzzleInput) txt = f.readlines() seat_id = 0 for i in txt: binary = i.replace('F', '0') binary = binary.replace('B', '1') binary = binary.replace('L', '0') binary = binary.replace('R', '1') row = int(binary[:7], 2) seat = int(binary[7:], 2) if seatID...
def metade(n=0): res = n / 2 return res def dobro(n=0): res = n * 2 return res def aumentar(n=0, taxa=0): res = n + (n * taxa/100) return res def diminuir(n=0, taxa=0): res = n - (n * taxa/100) return res def virgula(n=0, moed='R$'): return f'{moed}{n:.2f}'.replace('.', '...
def metade(n=0): res = n / 2 return res def dobro(n=0): res = n * 2 return res def aumentar(n=0, taxa=0): res = n + n * taxa / 100 return res def diminuir(n=0, taxa=0): res = n - n * taxa / 100 return res def virgula(n=0, moed='R$'): return f'{moed}{n:.2f}'.replace('.', ',')
class ArrayQueue: def __init__(self, max=10): self._data = [None] * max self._size = 0 self._front = 0 self._max = max def enqueue(self, e): self._data[(self._front + self._size) % self._max] = e self._size += 1 def dequeue(self): rst, self._data[sel...
class Arrayqueue: def __init__(self, max=10): self._data = [None] * max self._size = 0 self._front = 0 self._max = max def enqueue(self, e): self._data[(self._front + self._size) % self._max] = e self._size += 1 def dequeue(self): (rst, self._data[s...
def main(): info('Entering Pump minibone script') v=get_resource_value(name='JanMiniboneFlag') info('get resource value {}'.format(v)) if get_resource_value(name='JanMiniboneFlag'): info('Pump minibone') close(description='Bone to Minibone') open(description='M...
def main(): info('Entering Pump minibone script') v = get_resource_value(name='JanMiniboneFlag') info('get resource value {}'.format(v)) if get_resource_value(name='JanMiniboneFlag'): info('Pump minibone') close(description='Bone to Minibone') open(description='Microbone to Minib...
{ "targets": [ { "include_dirs": [ "<!(node -e \"require('nan')\")", "./lib/" ], "cflags": ["-Wstack-protector", "-Wall"], "target_name": "addon", "sources": [ './lib/metaphone_ptbr.c', 'main.cpp' ] } ] }
{'targets': [{'include_dirs': ['<!(node -e "require(\'nan\')")', './lib/'], 'cflags': ['-Wstack-protector', '-Wall'], 'target_name': 'addon', 'sources': ['./lib/metaphone_ptbr.c', 'main.cpp']}]}
def Partition(A, low, high): Pivot = A[high-1] i = low-1 for j in range(low, high-1): if(A[j] < Pivot): i+=1 A[i], A[j] = A[j], A[i] A[i+1], A[high-1] = A[high-1], A[i+1] return i+1 def QuickSort(A, low, high): if(high-low > 1): mid = Partition(A, low, high) QuickSort(A, low, mid) QuickSort(A, mid+...
def partition(A, low, high): pivot = A[high - 1] i = low - 1 for j in range(low, high - 1): if A[j] < Pivot: i += 1 (A[i], A[j]) = (A[j], A[i]) (A[i + 1], A[high - 1]) = (A[high - 1], A[i + 1]) return i + 1 def quick_sort(A, low, high): if high - low > 1: ...
class Solution: def longestDecomposition(self, text: str) -> int: l = 0 r = len(text)-1 l_stack = [] r_stack = [] count = 0 while r > l: l_stack += [text[l]] r_stack += [text[r]] l_stack.sort() r_stack.sort() ...
class Solution: def longest_decomposition(self, text: str) -> int: l = 0 r = len(text) - 1 l_stack = [] r_stack = [] count = 0 while r > l: l_stack += [text[l]] r_stack += [text[r]] l_stack.sort() r_stack.sort() ...
# -*- coding: UTF-8 -*- logger.info("Loading 0 objects to table checkdata_problem...") # fields: id, owner_type, owner_id, user, checker, message loader.flush_deferred_objects()
logger.info('Loading 0 objects to table checkdata_problem...') loader.flush_deferred_objects()
# Python Week-7 Day-48 # Python Scope # A variable created inside a function is available inside that function print("\n-----") def myfunc(): x = "Python Scope" print (x) myfunc() print("\n-----") # The local variable can be accessed from # a function within the function. def myfunc1(): xx = "Call Me" ...
print('\n-----') def myfunc(): x = 'Python Scope' print(x) myfunc() print('\n-----') def myfunc1(): xx = 'Call Me' def myfunc2(): print(xx) myfunc2() myfunc1() print('\n-----') y = 'Global Variable' def my_global(): global yy yy = 'variable inside function ' print(y, ' => ins...
# -*- coding: utf-8 -*- extensions = [ 'jupyter_sphinx', 'jupyterlite_sphinx', 'sphinx.ext.autodoc', 'sphinx.ext.coverage', 'sphinx.ext.napoleon','sphinx.ext.todo', 'sphinx.ext.viewcode' ] templates_path = ['_templates'] jupyterlite_config = "jupyterlite_config.json" def setup(app): app.add_css_file("main_s...
extensions = ['jupyter_sphinx', 'jupyterlite_sphinx', 'sphinx.ext.autodoc', 'sphinx.ext.coverage', 'sphinx.ext.napoleon', 'sphinx.ext.todo', 'sphinx.ext.viewcode'] templates_path = ['_templates'] jupyterlite_config = 'jupyterlite_config.json' def setup(app): app.add_css_file('main_stylesheet.css') master_doc = 'in...
TOKEN = 'YOUR_BOT_TOKEN_HERE' BASE_URL = 'https://api.telegram.org/bot' + TOKEN + '/' WIKIMAPIA_API_KEY = 'WIKIMAPIA_API_KEY_HERE'
token = 'YOUR_BOT_TOKEN_HERE' base_url = 'https://api.telegram.org/bot' + TOKEN + '/' wikimapia_api_key = 'WIKIMAPIA_API_KEY_HERE'
jolts = set() max_jolt = 0 try: while True: num = int(input()) max_jolt = max(max_jolt, num) jolts.add(num) except EOFError: pass target_jolt = max_jolt + 3 jolts.add(target_jolt) arrs = [0] * (target_jolt + 1) arrs[0] = 1 for i in range(1, target_jolt + 1): if i in jolts: ...
jolts = set() max_jolt = 0 try: while True: num = int(input()) max_jolt = max(max_jolt, num) jolts.add(num) except EOFError: pass target_jolt = max_jolt + 3 jolts.add(target_jolt) arrs = [0] * (target_jolt + 1) arrs[0] = 1 for i in range(1, target_jolt + 1): if i in jolts: ar...
inputfile = open('input.txt','r').readlines() for i in range(len(inputfile)): inputfile[i] = inputfile[i].strip('\n') # Notes: DICTIONARY, edge cases eg: contain no other bags part = 2 # 1 or 2 answer = [] if part == 1: bagDict = {} for i in inputfile: lineList = i.split(" ") key = "" ...
inputfile = open('input.txt', 'r').readlines() for i in range(len(inputfile)): inputfile[i] = inputfile[i].strip('\n') part = 2 answer = [] if part == 1: bag_dict = {} for i in inputfile: line_list = i.split(' ') key = '' if lineList[4] == 'no': pass else: ...
while True: L,R=map(int,input().split()) if L==R==0:break print(L+R)
while True: (l, r) = map(int, input().split()) if L == R == 0: break print(L + R)
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2021 Naomasa Matsubayashi # # 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 t...
def get_header(name, header_version): return '/*\n * Copyright (c) 2021 Naomasa Matsubayashi\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the "Software"), to deal\n * in the Software without restriction, including witho...
def collatz(n): result = [str(n)] while n > 1: if n % 2 == 0: n /= 2 else: n = (3 * n) + 1 result.append(str(n)) return '->'.join(result)
def collatz(n): result = [str(n)] while n > 1: if n % 2 == 0: n /= 2 else: n = 3 * n + 1 result.append(str(n)) return '->'.join(result)
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
def load_arguments(self, _): with self.argument_context('communication update') as c: c.argument('location', validator=None) with self.argument_context('communication identity issue-access-token') as c: c.argument('userid', options_list=['--userid', '-u'], type=str, help='ACS identifier') ...