content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
n = int(input()) arr = list(map(int, input().split(' '))) arr.sort(reverse=True) for i in range(n-2): if arr[i+2]+arr[i+1]>arr[i]: print(arr[i+2],arr[i+1],arr[i]) break if i==n-3: print(-1)
n = int(input()) arr = list(map(int, input().split(' '))) arr.sort(reverse=True) for i in range(n - 2): if arr[i + 2] + arr[i + 1] > arr[i]: print(arr[i + 2], arr[i + 1], arr[i]) break if i == n - 3: print(-1)
# -*- coding: utf-8 -*- class DoNothing(): def __init__(self): print("Do Nothing")
class Donothing: def __init__(self): print('Do Nothing')
class LogMetricsConfig: enable_logmetrics = True enable_frontend_request = True enable_frontend_response = True enable_backend = True enable_backend_request = True enable_backend_response = True @classmethod def set_internal_state(cls, enable_logmetrics=True, ...
class Logmetricsconfig: enable_logmetrics = True enable_frontend_request = True enable_frontend_response = True enable_backend = True enable_backend_request = True enable_backend_response = True @classmethod def set_internal_state(cls, enable_logmetrics=True, enable_frontend_request=Tru...
{ "targets": [ { "target_name": "ccio", "sources": [ "src/ccio.cc" ] } ] }
{'targets': [{'target_name': 'ccio', 'sources': ['src/ccio.cc']}]}
# -*- coding: utf-8 -*- fr = file("OSHW_COPPER_10MM.mod", "r") fw = file("OSHW_COPPER_10MM.2.mod", "w") d = fr.read() fr.close() d = d.splitlines() for l in d: if l[0:2] == "Sh": l = l.split() l[3] = str(int(int(l[3]) / 4.8)) l[4] = str(int(int(l[4]) / 4.8)) l[6] = str(int(int(l[6]) / 4.8)) l =...
fr = file('OSHW_COPPER_10MM.mod', 'r') fw = file('OSHW_COPPER_10MM.2.mod', 'w') d = fr.read() fr.close() d = d.splitlines() for l in d: if l[0:2] == 'Sh': l = l.split() l[3] = str(int(int(l[3]) / 4.8)) l[4] = str(int(int(l[4]) / 4.8)) l[6] = str(int(int(l[6]) / 4.8)) l = ' '....
# FileErrors class FileError(Exception): def __init__(self, filename, action): self.filename = filename self.action = action if self.action == 'r': self.action = 'read' elif self.action == 'w': self.action = 'write' class FileOpenError(FileError): def __str__(self): ...
class Fileerror(Exception): def __init__(self, filename, action): self.filename = filename self.action = action if self.action == 'r': self.action = 'read' elif self.action == 'w': self.action = 'write' class Fileopenerror(FileError): def __str__(self):...
load("@npm//@bazel/typescript:index.bzl", _ts_library = "ts_library") load("@npm//@bazel/esbuild:index.bzl", _esbuild = "esbuild") load("@npm//esbuild-visualizer:index.bzl", "esbuild_visualizer") def ts_library(name, **kwargs): module_name = kwargs["module_name"] if "module_name" in kwargs else None package_na...
load('@npm//@bazel/typescript:index.bzl', _ts_library='ts_library') load('@npm//@bazel/esbuild:index.bzl', _esbuild='esbuild') load('@npm//esbuild-visualizer:index.bzl', 'esbuild_visualizer') def ts_library(name, **kwargs): module_name = kwargs['module_name'] if 'module_name' in kwargs else None package_name =...
# https://leetcode.com/explore/learn/card/fun-with-arrays/527/searching-for-items-in-an-array/3250/ arr = [-8,-2,11,12,17] original = 0 arr = list(set(arr)) ln = len(arr) for i,elmnt in enumerate(arr): original = arr[i] arr[i] = arr[i]*2 if len(set(arr))<ln: print(arr) print(set(arr)) print(elmnt,"true") if ...
arr = [-8, -2, 11, 12, 17] original = 0 arr = list(set(arr)) ln = len(arr) for (i, elmnt) in enumerate(arr): original = arr[i] arr[i] = arr[i] * 2 if len(set(arr)) < ln: print(arr) print(set(arr)) print(elmnt, 'true') if original % 2 == 0: arr[i] = original / 2 if...
# # PySNMP MIB module Nortel-Magellan-Passport-ExtensionsMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-ExtensionsMIB # Produced by pysmi-0.3.4 at Wed May 1 14:27:03 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) ...
bp = [3,2,1] #buying power g,s,c = input().split() g,s,c = int(g), int(s), int(c) tbp = g*bp[0] + s*bp[1] + c*bp[2] ss = "" #victory cards if tbp >= 8: ss += "Province" elif tbp >=5 and tbp < 8: ss += "Duchy" elif tbp >= 2 and tbp < 5: ss += "Estate" ss += " or " if len(ss)>0 else "" #treasure cards...
bp = [3, 2, 1] (g, s, c) = input().split() (g, s, c) = (int(g), int(s), int(c)) tbp = g * bp[0] + s * bp[1] + c * bp[2] ss = '' if tbp >= 8: ss += 'Province' elif tbp >= 5 and tbp < 8: ss += 'Duchy' elif tbp >= 2 and tbp < 5: ss += 'Estate' ss += ' or ' if len(ss) > 0 else '' if tbp >= 6: ss += 'Gold' e...
class PostDTO(object): def __init__(self, post_obj): # Setting attribute for each field for key, value in post_obj.__dict__.items(): if not key.startswith("__"): setattr(self, key, value) # Now setting attribute for foreign, one to one, and/or m2m fields ...
class Postdto(object): def __init__(self, post_obj): for (key, value) in post_obj.__dict__.items(): if not key.startswith('__'): setattr(self, key, value) for (key, value) in self.__dict__.get('_prefetched_objects_cache').items(): if not key.startswith('__') ...
''' Known Peripheral UUIDs, obtained by querying using the Bluepy module: ===================================================================== Anti DOS Characteristic <00020005-574f-4f20-5370-6865726f2121> Battery Level Characteristic <Battery Level> Peripheral Preferred Connection Parameters Characteristic <Periphera...
""" Known Peripheral UUIDs, obtained by querying using the Bluepy module: ===================================================================== Anti DOS Characteristic <00020005-574f-4f20-5370-6865726f2121> Battery Level Characteristic <Battery Level> Peripheral Preferred Connection Parameters Characteristic <Periphera...
# optimizer optimizer = dict(type='SGD', lr=4e-3, momentum=0.9, weight_decay=0.0001, ) # paramwise_options=dict(bias_lr_mult=2, bias_decay_mult=0)) optimizer_config = dict(grad_clip=dict(max_norm=10, norm_type=2)) # learning policy lr_config = dict( ...
optimizer = dict(type='SGD', lr=0.004, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=dict(max_norm=10, norm_type=2)) lr_config = dict(policy='step', warmup='linear', warmup_iters=5000, warmup_ratio=0.1, step=[12, 24, 36, 48, 60, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124, 128, ...
# coding: utf-8 # In[4]: x = [0.0, 3.0, 5.0, 2.5, 3.7] #define array print(type(x)) #remove 3rd element x.remove(2.5) print(x) #add an element at the end x.append(1.2) print(x) #get a copy y = x.copy() print(y) #show many elements are 0.0 print(y.count(0.0)) #print index with value 3.7 #sort the list y.sort p...
x = [0.0, 3.0, 5.0, 2.5, 3.7] print(type(x)) x.remove(2.5) print(x) x.append(1.2) print(x) y = x.copy() print(y) print(y.count(0.0)) y.sort print(y) y.reverse() print(y) y.clear() print(y)
#!/usr/local/bin/python3 # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the L...
def read_lines(filename): content = () with open(filename) as f: content = f.readlines() content = [x.rstrip() for x in content] return content def scan_file(filename, callback): with open(filename) as f: for line in f: callback(line) def scan_file_with_context(filename...
# http://stackoverflow.com/questions/4999233/how-to-raise-error-if-duplicates-keys-in-dictionary class RejectingDict(dict): def __setitem__(self, k, v): if k in self: raise ValueError("Key is already present: " + repr(k)) return super().__setitem__(k, v) def force_insert(self, k, v)...
class Rejectingdict(dict): def __setitem__(self, k, v): if k in self: raise value_error('Key is already present: ' + repr(k)) return super().__setitem__(k, v) def force_insert(self, k, v): return super().__setitem__(k, v) class Patchingexception(Exception): pass class...
# Python port of LowMC.cpp found at # https://github.com/LowMC/lowmc/blob/master/LowMC.cpp def xor_block(block1, block2): return [b1 ^ b2 for b1, b2 in zip(block1, block2)] state = None # Keeps the 80 bit LSFR state def init_encrypt(_constant, _constants): # # Python polyfills for C++ std::bitset # ...
def xor_block(block1, block2): return [b1 ^ b2 for (b1, b2) in zip(block1, block2)] state = None def init_encrypt(_constant, _constants): bitset = lambda n, b: list([b]) * n numofboxes = 1 blocksize = 128 keysize = 40 rounds = 1 block = lambda : bitset(blocksize, 0) keyblock = lambda : ...
# WORKFLOW_CONFIG: Configuration information for the Plant IT server WORKFLOW_CONFIG = { ### # These values should not need changed. ### #Human readable workflow name "name": "Plant Image Analysis", #Human readable description "description": "", #Location of icon to show for the workf...
workflow_config = {'name': 'Plant Image Analysis', 'description': '', 'icon_loc': 'workflows/plant_image_analysis/icon.png', 'api_version': 0.1, 'app_name': 'plant_image_analysis', 'singularity_url': 'singularity shell shub://lsx1980/plant-image-analysis'} parameters = [{'id': 'settings', 'name': 'Workflow Settings', '...
Import("env") def fixLinkFlag (s): return s[4:] if s.startswith('-Wl,-T') else s env.Replace(LINKFLAGS = [fixLinkFlag(i) for i in env['LINKFLAGS']])
import('env') def fix_link_flag(s): return s[4:] if s.startswith('-Wl,-T') else s env.Replace(LINKFLAGS=[fix_link_flag(i) for i in env['LINKFLAGS']])
#$Id: LikelihoodLib.py,v 1.6 2015/12/10 00:57:57 echarles Exp $ def generate(env, **kw): if not kw.get('depsOnly',0): env.Tool('addLibrary', library=['Likelihood']) env.Tool('astroLib') env.Tool('xmlBaseLib') env.Tool('tipLib') env.Tool('evtbinLib') env.Tool('map_toolsLib') env.Tool(...
def generate(env, **kw): if not kw.get('depsOnly', 0): env.Tool('addLibrary', library=['Likelihood']) env.Tool('astroLib') env.Tool('xmlBaseLib') env.Tool('tipLib') env.Tool('evtbinLib') env.Tool('map_toolsLib') env.Tool('optimizersLib') env.Tool('irfLoaderLib') env.Tool('st_...
class A: def __init__(self): self.a = 1 def _foo(self): pass a_class = A() a_class._foo() print(a_class.a)
class A: def __init__(self): self.a = 1 def _foo(self): pass a_class = a() a_class._foo() print(a_class.a)
carros = int(input()) hmin = 24 mmin = 60 hmax = 0 mmax = 0 for i in range(0,carros): he,me,hs,ms = input().split() he = int(he) me = int(me) hs = int(hs) ms = int(ms) if he < hmin: hmin,mmin = he,me elif he == hmin: if me < mmin: mmin = me if hs > hmax: ...
carros = int(input()) hmin = 24 mmin = 60 hmax = 0 mmax = 0 for i in range(0, carros): (he, me, hs, ms) = input().split() he = int(he) me = int(me) hs = int(hs) ms = int(ms) if he < hmin: (hmin, mmin) = (he, me) elif he == hmin: if me < mmin: mmin = me if hs >...
class node: def __init__(self, freq, char, children): self.freq = freq self.char = char self.children = children self.code = '' def collect_code(node, huffman_code, result): huffman_code = huffman_code + str(node.code) for c in range(len(node.children)): collect_code...
class Node: def __init__(self, freq, char, children): self.freq = freq self.char = char self.children = children self.code = '' def collect_code(node, huffman_code, result): huffman_code = huffman_code + str(node.code) for c in range(len(node.children)): collect_cod...
class OrderSpec(object): ''' Base class for an order to buy/sell, and whether it succeeded ("filled") ''' def __init__(self, buy=False, sell=False, price=0, qty=0, src_tuple=None, empty=False): if src_tuple is not None: self.buy, self.sell, self.price, self.qty,...
class Orderspec(object): """ Base class for an order to buy/sell, and whether it succeeded ("filled") """ def __init__(self, buy=False, sell=False, price=0, qty=0, src_tuple=None, empty=False): if src_tuple is not None: (self.buy, self.sell, self.price, self.qty, self.empty) = ...
load("//:compile.bzl", "proto_compile") def ts_grpc_compile(**kwargs): proto_compile( plugins = [ str(Label("//github.com/grpc/grpc-web:ts")), ], **kwargs )
load('//:compile.bzl', 'proto_compile') def ts_grpc_compile(**kwargs): proto_compile(plugins=[str(label('//github.com/grpc/grpc-web:ts'))], **kwargs)
#!/usr/bin/env python3 class Solution: def maxProfitAssignment(self, difficulty, profit, worker): worker, i = sorted(worker, reverse=True), 0 l, ret = len(worker), 0 for p, d in sorted(zip(profit, difficulty), reverse=True): while i < l and worker[i] >= d: ret, ...
class Solution: def max_profit_assignment(self, difficulty, profit, worker): (worker, i) = (sorted(worker, reverse=True), 0) (l, ret) = (len(worker), 0) for (p, d) in sorted(zip(profit, difficulty), reverse=True): while i < l and worker[i] >= d: (ret, i) = (ret +...
class Memory: def __init__(self): self.setDefault() def setDefault(self): self.memory = [0, 0, 0, 0, 0, 0, 0] def get(self, address): return self.memory[address] def write(self, address, data): self.memory[address] = data
class Memory: def __init__(self): self.setDefault() def set_default(self): self.memory = [0, 0, 0, 0, 0, 0, 0] def get(self, address): return self.memory[address] def write(self, address, data): self.memory[address] = data
def loading_bar(n): ready = ("%"*int(n/10)) remain = ("."*int(10-n/10)) loading_bara = ready+remain return loading_bara n = int(input()) if n == 100: print(f'100% Complete!\n') print(f'[{loading_bar(n)}]') else: print(f'{n}% [{loading_bar(n)}]') print(f'Still loading...') # if number ...
def loading_bar(n): ready = '%' * int(n / 10) remain = '.' * int(10 - n / 10) loading_bara = ready + remain return loading_bara n = int(input()) if n == 100: print(f'100% Complete!\n') print(f'[{loading_bar(n)}]') else: print(f'{n}% [{loading_bar(n)}]') print(f'Still loading...')
class Customer: def __init__(self, cust_id, cust_name, location): self.cust_id = cust_id self.cust_name = cust_name self.location = location list_of_customers = [Customer(101, 'Mark', 'US'), Customer(102, 'Jane', 'Japan'), Customer(103, 'Kumar', 'I...
class Customer: def __init__(self, cust_id, cust_name, location): self.cust_id = cust_id self.cust_name = cust_name self.location = location list_of_customers = [customer(101, 'Mark', 'US'), customer(102, 'Jane', 'Japan'), customer(103, 'Kumar', 'India')] dict_of_customer = {} for customer ...
Persona1={'nombre':'Fernando', 'apellido':'Avalos','edad':'24', 'ciudad':'Saltillo'} Persona2={'nombre':'Luis', 'apellido':'Fernandez','edad':'35', 'ciudad':'Monterrey'} Persona3={'nombre':'Karina', 'apellido':'Gutierrez','edad':'15', 'ciudad':'San Pedro'} People=[Persona1,Persona2,Persona3] for per in People: pr...
persona1 = {'nombre': 'Fernando', 'apellido': 'Avalos', 'edad': '24', 'ciudad': 'Saltillo'} persona2 = {'nombre': 'Luis', 'apellido': 'Fernandez', 'edad': '35', 'ciudad': 'Monterrey'} persona3 = {'nombre': 'Karina', 'apellido': 'Gutierrez', 'edad': '15', 'ciudad': 'San Pedro'} people = [Persona1, Persona2, Persona3] fo...
r=range n=128 h="" for j in r(n): u=256 l=list(r(u)) p=0 s=0 for i in map(ord,(f"hxtvlmkl-{j}\x11\x1fI/\x17")*64): l=l[p:]+l[:p] l[:i]=reversed(l[:i]) l=l[-p:]+l[:-p] p=(p+s+i)%u s+=1 k=0 for i in r(u): k^=l[i] if i%16==15: h+=f"{k:08b}" k=0 q=list(map(int,h)) print(sum(q)) s=0 for i in r(n*n...
r = range n = 128 h = '' for j in r(n): u = 256 l = list(r(u)) p = 0 s = 0 for i in map(ord, f'hxtvlmkl-{j}\x11\x1fI/\x17' * 64): l = l[p:] + l[:p] l[:i] = reversed(l[:i]) l = l[-p:] + l[:-p] p = (p + s + i) % u s += 1 k = 0 for i in r(u): k ^=...
# 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 law or agreed to in writing, software # distributed under t...
def get_profile_args(global_profile, local_profile): args = [] a_encoder = None a_tracks = None if 'audio' in global_profile: if 'encoder' in global_profile['audio']: a_encoder = global_profile['audio']['encoder'] if 'tracks' in global_profile['audio']: a_tracks =...
class Solution: def sumZero(self, n: int) -> List[int]: s=-1 x=[] if n%2==0: for i in range(n//2): x.append(s) x.append(abs(s)) s=s-1 else: x.append(0) for i in range(n//2): x.append(s...
class Solution: def sum_zero(self, n: int) -> List[int]: s = -1 x = [] if n % 2 == 0: for i in range(n // 2): x.append(s) x.append(abs(s)) s = s - 1 else: x.append(0) for i in range(n // 2): ...
for _ in range(int(input())) : n = int(input()) arr = list(map(int, input().split())) x = min(arr) if(arr.count(x)%2 is 0) : print("Unlucky") else : print("Lucky")
for _ in range(int(input())): n = int(input()) arr = list(map(int, input().split())) x = min(arr) if arr.count(x) % 2 is 0: print('Unlucky') else: print('Lucky')
x = int(input()) serie = [] for i in range(1, 101, 1): serie.append((i*(x**i)/(i**2))) media = 0 for i in serie: media += i media = media / 100 menorm = 0 for i in serie: if i < media: menorm += 1 print(menorm)
x = int(input()) serie = [] for i in range(1, 101, 1): serie.append(i * x ** i / i ** 2) media = 0 for i in serie: media += i media = media / 100 menorm = 0 for i in serie: if i < media: menorm += 1 print(menorm)
def is_palindrome(string): return(string[::-1]).casefold() == string.casefold() def palindrome_sentence(sentence): string = "" for char in sentence: if char.isalnum(): string += char print(string) return is_palindrome(string) word = input("Please input any word:") if is_pal...
def is_palindrome(string): return string[::-1].casefold() == string.casefold() def palindrome_sentence(sentence): string = '' for char in sentence: if char.isalnum(): string += char print(string) return is_palindrome(string) word = input('Please input any word:') if is_palin...
class Solution: def threeSum(self, nums: List[int]) -> List[List[int]]: res = deque() s = set() visited = set() for ind, i in enumerate(nums): d = {} if i in visited: continue visited.add(i) for ind2 in range(ind+1, len(nums)): ...
class Solution: def three_sum(self, nums: List[int]) -> List[List[int]]: res = deque() s = set() visited = set() for (ind, i) in enumerate(nums): d = {} if i in visited: continue visited.add(i) for ind2 in range(ind + 1...
{ 'includes': [ 'deps/common.gyp' ], 'targets': [ { 'target_name': 'pHashBinding', 'defines': [ 'HAVE_IMAGE_HASH', 'cimg_verbosity=0', 'cimg_use_png', 'cimg_use_jpeg', ], 'include_dirs': [ "<!(node -e \"require('nan')\")", 'deps/pHash', ...
{'includes': ['deps/common.gyp'], 'targets': [{'target_name': 'pHashBinding', 'defines': ['HAVE_IMAGE_HASH', 'cimg_verbosity=0', 'cimg_use_png', 'cimg_use_jpeg'], 'include_dirs': ['<!(node -e "require(\'nan\')")', 'deps/pHash', 'deps/libpng', 'deps/libjpeg'], 'sources': ['src/phash.cpp'], 'dependencies': ['deps/zlib/zl...
dict( path = "/home/lvapeab/smt/software/GroundHog/tutorials/DATA/ue.npz", dictionary = "/home/lvapeab/smt/software/GroundHog/tutorials/DATA/ue_dict.npz", chunks = 'words', n_in = 4745, n_out = 4745, trainFreq = 500, hookFreq = 1000, validFreq = 1000, inp_nhids = '[400]', dout_nhid = '400', nhids = '[400]', seqlen ...
dict(path='/home/lvapeab/smt/software/GroundHog/tutorials/DATA/ue.npz', dictionary='/home/lvapeab/smt/software/GroundHog/tutorials/DATA/ue_dict.npz', chunks='words', n_in=4745, n_out=4745, trainFreq=500, hookFreq=1000, validFreq=1000, inp_nhids='[400]', dout_nhid='400', nhids='[400]', seqlen=40, join='concat', prefix='...
_base_ = 'byol_resnet50_8xb256-fp16-accum2-coslr-200e_in1k.py' # runtime settings runner = dict(type='EpochBasedRunner', max_epochs=300)
_base_ = 'byol_resnet50_8xb256-fp16-accum2-coslr-200e_in1k.py' runner = dict(type='EpochBasedRunner', max_epochs=300)
# vim: fileencoding=utf8:et:sw=4:ts=8:sts=4 NULL = 0 INT = 1 STR = 2 UTF = 3 SERIAL = 4 ALL = frozenset([NULL, INT, STR, UTF, SERIAL])
null = 0 int = 1 str = 2 utf = 3 serial = 4 all = frozenset([NULL, INT, STR, UTF, SERIAL])
class EsConfig: ES = {"host": 'localhost', "port": 9200} INDEX = 'ssh-connections-alias'
class Esconfig: es = {'host': 'localhost', 'port': 9200} index = 'ssh-connections-alias'
# -*- coding: utf-8 -*- # # -- General configuration ---------------------------------------- source_suffix = '.rst' master_doc = 'index' project = u'sphinx theme for reveal.js' copyright = u'2014, tell-k' version = '0.3.0' # -- Options for HTML output -------------------------------------- extension...
source_suffix = '.rst' master_doc = 'index' project = u'sphinx theme for reveal.js' copyright = u'2014, tell-k' version = '0.3.0' extensions = ['sphinxjp.themes.revealjs'] html_theme = 'revealjs' html_use_index = False html_theme_options = {'lang': 'ja', 'width': 960, 'height': 700, 'margin': 0.1, 'min_scale': 0.2, 'ma...
FLAIR_RULES_1 = [ { "key": "ScanningSequence", "value": ("Spin Echo", "Inversion Recovery"), "lookup": "exact", }, { "key": "SequenceVariant", "value": ("Segmented k-Space", "Spoiled", "MAG Prepared"), "lookup": "exact", }, ] FLAIR_RULES_2 = [ { ...
flair_rules_1 = [{'key': 'ScanningSequence', 'value': ('Spin Echo', 'Inversion Recovery'), 'lookup': 'exact'}, {'key': 'SequenceVariant', 'value': ('Segmented k-Space', 'Spoiled', 'MAG Prepared'), 'lookup': 'exact'}] flair_rules_2 = [{'key': 'ScanningSequence', 'value': ('Spin Echo', 'Inversion Recovery'), 'lookup': 'e...
# Copyright (c) 2016 Mirantis, 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 by applicable law or agreed to in wri...
class Staticactionresult(object): def __init__(self, result, exception=None): self._result = result self._exception = exception def get_result(self): if self._exception: raise self._exception return self._result def check_result(self): return True clas...
class Solution: def reverse(self, x: int) -> int: max_integer = 2 ** 31 - 1 min_integer = - 2 ** 31 sign = 1 if x >= 0 else -1 x = abs(x) reverse = 0 while x > 0: reverse = reverse * 10 + x % 10 x = x // 10 res ...
class Solution: def reverse(self, x: int) -> int: max_integer = 2 ** 31 - 1 min_integer = -2 ** 31 sign = 1 if x >= 0 else -1 x = abs(x) reverse = 0 while x > 0: reverse = reverse * 10 + x % 10 x = x // 10 res = sign * reverse ...
# size(1000,1000) # module = 250 # padding = 50 w = 1000 h = 1000 module = 100 padding = 20 size(w, h) width = range(0, width(), module) height = range(0, height(), module) def recursion(xcenter, ycenter, radius): fill(.7, 0.1, random(), random()) if radius <10: return else: #green ...
w = 1000 h = 1000 module = 100 padding = 20 size(w, h) width = range(0, width(), module) height = range(0, height(), module) def recursion(xcenter, ycenter, radius): fill(0.7, 0.1, random(), random()) if radius < 10: return else: fill(random(), 0.7, random(), 1) rect(xcenter, ycente...
#example program on Condiion statement (IBM Digital Nation Africa) cost = float(10.5) money = float(20.5) if money>cost : print("I can afford the Apple") print("After the if statement") #end-of-the-program
cost = float(10.5) money = float(20.5) if money > cost: print('I can afford the Apple') print('After the if statement')
class HTTPClientError(Exception): pass class HTTPClientConnectionFailed(HTTPClientError): pass class PoolError(HTTPClientError): pass class URLResolverError(HTTPClientError): pass class UrlValidationError(URLResolverError): pass
class Httpclienterror(Exception): pass class Httpclientconnectionfailed(HTTPClientError): pass class Poolerror(HTTPClientError): pass class Urlresolvererror(HTTPClientError): pass class Urlvalidationerror(URLResolverError): pass
a = [2 ** x for x in range(4)] i=0 while i!=4: i += 1 a[i] = input("Ingresa tu numero") print(a[i])
a = [2 ** x for x in range(4)] i = 0 while i != 4: i += 1 a[i] = input('Ingresa tu numero') print(a[i])
if 5 < 2: 3 else: if True: 4 + 7 4 + 4 5 + 5
if 5 < 2: 3 else: if True: 4 + 7 4 + 4 5 + 5
#!/usr/bin/env python3 n, x, *a = map(int, open(0).read().split()) b = bin(x)[::-1] s = 0 for i, k in enumerate(a): if b[i:i+1] == "1": s += k print(s)
(n, x, *a) = map(int, open(0).read().split()) b = bin(x)[::-1] s = 0 for (i, k) in enumerate(a): if b[i:i + 1] == '1': s += k print(s)
# -*- coding: utf-8 -*- # Created by lvjiyong on 16/5/6 HOST = '192.168.0.1' PORT = 8888
host = '192.168.0.1' port = 8888
class A(object): __class__ = int class B(A): def foo(self): return __class__ # <ref>
class A(object): __class__ = int class B(A): def foo(self): return __class__
def get_color(): # color is an RGB value in string, e.g # 255,1,0 color = input("Type the color in string(e.g. 255,1,0)") Try = 1 while True: if Try != 1: color = input("Type the color in string(e.g. 255,1,0)") elif Try == 3: print("Too many attempts, 0 is retur...
def get_color(): color = input('Type the color in string(e.g. 255,1,0)') try = 1 while True: if Try != 1: color = input('Type the color in string(e.g. 255,1,0)') elif Try == 3: print('Too many attempts, 0 is returned by default.') return 0 try: ...
# # PySNMP MIB module BENU-KAFKA-CLIENT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BENU-KAFKA-CLIENT-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:37:26 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint, constraints_union) ...
# We currently recommend using Python 3.5 username = "rithvik.chuppala@gmail.com" # Here enter your API user name password = "p8N5Yag7RFc29Gjn4" # Here enter your API password priaid_authservice_url = "https://sandbox-authservice.priaid.ch/login" # Be aware that sandbox link is for testing pourpose (not real data)...
username = 'rithvik.chuppala@gmail.com' password = 'p8N5Yag7RFc29Gjn4' priaid_authservice_url = 'https://sandbox-authservice.priaid.ch/login' priaid_healthservice_url = 'https://sandbox-healthservice.priaid.ch' language = 'en-gb' pritn_raw_output = False
CAMPAIGN_TRACKING_PARAMS = { 'cc': 'utm_content', 'ck': 'utm_term', 'cs': 'utm_source', 'cm': 'utm_medium', 'cn': 'utm_campaign', 'gclid': 'gclid', }
campaign_tracking_params = {'cc': 'utm_content', 'ck': 'utm_term', 'cs': 'utm_source', 'cm': 'utm_medium', 'cn': 'utm_campaign', 'gclid': 'gclid'}
# Program 1 # print(4) # print("Hello Class") # Output: Hello Class # a = "Hello Python" # print(a) # Output: Hello Python # message = "I am Studying in Uaf" # abc = 123 # pi = 3.14 # print(message,abc,pi) # Output: I am studying in Uaf 123 3.14 # print(type(message)) # Output: <class 'int'> # Program 2 # prin...
x = 12 // 3 print(type(x))
def print_board(board_input): print(f''' ------------- | {board_input[0]} | {board_input[1]} | {board_input[2]} | ------------- | {board_input[3]} | {board_input[4]} | {board_input[5]} | ------------- | {board_input[6]} | {board_input[7]} | {board_input[8]} | -------------''') q = 'y...
def print_board(board_input): print(f'\n -------------\n | {board_input[0]} | {board_input[1]} | {board_input[2]} |\n -------------\n | {board_input[3]} | {board_input[4]} | {board_input[5]} |\n -------------\n | {board_input[6]} | {board_input[7]} | {board_input[8]} |\n -------------') q = 'y'...
class User: def __init__(self, uid): self.games = [] self.uid = uid def submitCount(self): count = 0 for game in self.games: count += len(game.submits) return count class Game: def __init__(self): self.submits = [] def successful(self): ...
class User: def __init__(self, uid): self.games = [] self.uid = uid def submit_count(self): count = 0 for game in self.games: count += len(game.submits) return count class Game: def __init__(self): self.submits = [] def successful(self): ...
def flatten(d): if d == {}: return d else: k, v = d.popitem() if dict != type(v): return {k: v, **flatten(d)} else: flat_kv = flatten(v) for k1 in list(flat_kv.keys()): flat_kv[str(k) + '.' + str(k1)] = flat_kv[k1] ...
def flatten(d): if d == {}: return d else: (k, v) = d.popitem() if dict != type(v): return {k: v, **flatten(d)} else: flat_kv = flatten(v) for k1 in list(flat_kv.keys()): flat_kv[str(k) + '.' + str(k1)] = flat_kv[k1] ...
# These dictionaries are merged with the extracted function metadata at build time. # Changes to the metadata should be made here, because functions.py is generated thus any changes get overwritten. functions_override_metadata = { } functions_additional_create_advanced_sequence = { 'FancyCreateAdvancedSequence': ...
functions_override_metadata = {} functions_additional_create_advanced_sequence = {'FancyCreateAdvancedSequence': {'codegen_method': 'python-only', 'returns': 'ViStatus', 'python_name': 'create_advanced_sequence', 'method_templates': [{'session_filename': 'fancy_advanced_sequence', 'documentation_filename': 'default_met...
# Copyright 2021 Richard Johnston <techpowerawaits@outlook.com> # SPDX-license-identifier: 0BSD class AxGetException(Exception): pass class DirNotExistError(AxGetException): def __init__(self, filepath): self.message = f"The directory {filepath} does not exist" super().__init__(self.message)...
class Axgetexception(Exception): pass class Dirnotexisterror(AxGetException): def __init__(self, filepath): self.message = f'The directory {filepath} does not exist' super().__init__(self.message) class Dirnotaccessibleerror(AxGetException): def __init__(self, filepath): self.mes...
# # PySNMP MIB module ATSWTCH2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ATSWTCH2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:14:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_range_constraint, value_size_constraint, single_value_constraint) ...
N = int(input()) if N <= 111: print(111) elif 111 < N <= 222: print(222) elif 222 < N <= 333: print(333) elif 333 < N <= 444: print(444) elif 444 < N <= 555: print(555) elif 555 < N <= 666: print(666) elif 666 < N <= 777: print(777) elif 777 < N <= 888: print(888) elif 888 < N <= 999: ...
n = int(input()) if N <= 111: print(111) elif 111 < N <= 222: print(222) elif 222 < N <= 333: print(333) elif 333 < N <= 444: print(444) elif 444 < N <= 555: print(555) elif 555 < N <= 666: print(666) elif 666 < N <= 777: print(777) elif 777 < N <= 888: print(888) elif 888 < N <= 999: ...
def main(j, args, params, tags, tasklet): params.merge(args) params.result = "" doc = params.doc if doc.content.find("@DESTRUCTED@") != -1: # page no longer show, destruction message doc.destructed = True doc.content = doc.content.replace("@DESTRUCTED@", "") else: ...
def main(j, args, params, tags, tasklet): params.merge(args) params.result = '' doc = params.doc if doc.content.find('@DESTRUCTED@') != -1: doc.destructed = True doc.content = doc.content.replace('@DESTRUCTED@', '') elif doc.destructed is False: newdoc = '@DESTRUCTED@\n%s' % ...
# While loops x = 0 while x < 5: print(f'Current value of x is: {x}') x += 1 else: print("X is not less than five") # Break, Continue, Pass # break: Breaks out of the current closest enclosing loop. # continue: Goes to the top of the closest enclosing loop. # pass: Does nothing at all # Pass print('# Pa...
x = 0 while x < 5: print(f'Current value of x is: {x}') x += 1 else: print('X is not less than five') print('# Pass #') x = [1, 2, 3] for i in x: pass print('# Continue #') my_string = 'David' for letter in myString: if letter == 'a': continue print(letter) print('# Break #') my_string =...
def quicksort(left,right,p): l=left r=right pivot=list[left] while(left<right): if p==1: while((list[right]>=pivot) and left<right): right=right-1 if(left!=right): ...
def quicksort(left, right, p): l = left r = right pivot = list[left] while left < right: if p == 1: while list[right] >= pivot and left < right: right = right - 1 if left != right: list[left] = list[right] left = left + 1 ...
def find_symbols(nodes): symbols = {} #variables, docs and contexts for symbol_type in ("doc", "variable", "context"): for node in nodes[symbol_type]: name = node["name"] if name in symbols: other_symbol_type = symbols[name]["type"] msg = "Duplicat...
def find_symbols(nodes): symbols = {} for symbol_type in ('doc', 'variable', 'context'): for node in nodes[symbol_type]: name = node['name'] if name in symbols: other_symbol_type = symbols[name]['type'] msg = 'Duplicate symbol name: %s (%s and %s)'...
class Guitar: def play(self): return "Playing the guitar" class Children: def play(self): return "Children are playing" def eat(self): return 'Children are eating' def start_playing(i_can_play): return i_can_play.play() children = Children() guitar = Guitar() print(start_...
class Guitar: def play(self): return 'Playing the guitar' class Children: def play(self): return 'Children are playing' def eat(self): return 'Children are eating' def start_playing(i_can_play): return i_can_play.play() children = children() guitar = guitar() print(start_pla...
DICT = { 'update_radius' : 1, 'seed':160, 'number_of_runs':500, 'scramble_rate':1, 'initial_randomness':0.20, 'scramble_amount':0.1, 'valid_revision_limit' : 0.1 } def make_params_string(param_dict) : stringa = "" for key in param_dict : stringa += key + "=" + str(param_dict[key]) + '\n' return stringa def print...
dict = {'update_radius': 1, 'seed': 160, 'number_of_runs': 500, 'scramble_rate': 1, 'initial_randomness': 0.2, 'scramble_amount': 0.1, 'valid_revision_limit': 0.1} def make_params_string(param_dict): stringa = '' for key in param_dict: stringa += key + '=' + str(param_dict[key]) + '\n' return strin...
eval_iter_period = 5 checkpoint_config = dict(iter_period=eval_iter_period) log_config = dict(period=5) work_dir = './work_dirs' # the dir to save logs and models # load_from = '/home/datasets/mix_data/model/visdial_model_imix/vqa_weights.pth' # load_from = '~/iMIX/imix/work_dirs/epoch18_model.pth' # seed = 13 CUDNN_...
eval_iter_period = 5 checkpoint_config = dict(iter_period=eval_iter_period) log_config = dict(period=5) work_dir = './work_dirs' cudnn_benchmark = False model_device = 'cuda' find_unused_parameters = True gradient_accumulation_steps = 10 is_lr_accumulation = False
class Solution: def removeDuplicates(self, s: str, k: int) -> str: stack = [] for ch in s: if not stack or stack[-1][0] != ch: stack.append([ch, 1]) else: stack[-1][-1] = (stack[-1][-1] + 1) % k if stack[-1][-1] == 0: ...
class Solution: def remove_duplicates(self, s: str, k: int) -> str: stack = [] for ch in s: if not stack or stack[-1][0] != ch: stack.append([ch, 1]) else: stack[-1][-1] = (stack[-1][-1] + 1) % k if stack[-1][-1] == 0: ...
class Solution: def minMutation(self, start: str, end: str, bank: List[str]) -> int: bfs = [(start, 0)] while bfs: gene, step = bfs.pop(0) if gene == end: return step for i in range(8): for x in "ACGT": mutation = gene[:i] + x +...
class Solution: def min_mutation(self, start: str, end: str, bank: List[str]) -> int: bfs = [(start, 0)] while bfs: (gene, step) = bfs.pop(0) if gene == end: return step for i in range(8): for x in 'ACGT': mutat...
# # @lc app=leetcode id=350 lang=python3 # # [350] Intersection of Two Arrays II # # @lc code=start class Solution: def intersect(self, nums1, nums2): if not nums1 or not nums2: return [] d1 = dict() d2 = dict() while nums1: i1 = nums1.pop() if i1...
class Solution: def intersect(self, nums1, nums2): if not nums1 or not nums2: return [] d1 = dict() d2 = dict() while nums1: i1 = nums1.pop() if i1 not in d1: d1[i1] = 1 else: d1[i1] += 1 while n...
class Cocinero(): def prepararPlatillo(self): self.cuchillo = Cuchillo() self.cuchillo.cortarVegetales() self.estufa = Estufa() self.estufa.boilVegetables() self.freidora = Freidora() self.freidora.freirVegetales() class Cuchillo(): def cortarVegetales(self): ...
class Cocinero: def preparar_platillo(self): self.cuchillo = cuchillo() self.cuchillo.cortarVegetales() self.estufa = estufa() self.estufa.boilVegetables() self.freidora = freidora() self.freidora.freirVegetales() class Cuchillo: def cortar_vegetales(self): ...
n, kDomino = int(input().split()) prevPair = int(input().split()) for i in range(n - 1): nextPair = int(input().split())
(n, k_domino) = int(input().split()) prev_pair = int(input().split()) for i in range(n - 1): next_pair = int(input().split())
# Write your code here n,k = input().split() n = int(n) k = int(k) l = list(map(int,input().split())) i = 0 while (i < n) : if (i + k < n + 1) : print(max(l[i:i + k]),end = " ") i += 1
(n, k) = input().split() n = int(n) k = int(k) l = list(map(int, input().split())) i = 0 while i < n: if i + k < n + 1: print(max(l[i:i + k]), end=' ') i += 1
def grab_shape(slide, shape_name): return slide.Shapes(shape_name) def grab_styles(shape): return {'width': shape.Width, 'height': shape.Height, 'top': shape.Top, 'left': shape.Left, 'lock_aspect_ratio': shape.LockAspectRatio} def apply_styles(shape, styl...
def grab_shape(slide, shape_name): return slide.Shapes(shape_name) def grab_styles(shape): return {'width': shape.Width, 'height': shape.Height, 'top': shape.Top, 'left': shape.Left, 'lock_aspect_ratio': shape.LockAspectRatio} def apply_styles(shape, styles): shape.LockAspectRatio = styles['lock_aspect_ra...
#!/usr/bin/python # A function is a block of code which only runs when it is called. It can pass parameters and can return data as a result. def func(): print("Hello function") # function is defined using the def keyword func() # calling a func # Information can be passed to functions as parameter.You can a...
def func(): print('Hello function') func() def func2(fname): print('HI ' + fname) func2('X') func2('Y') func2('Z') def func3(game='Football'): print('I play ' + game) func3('Cricket') func3() def func4(y=1): return y + 1 print(func4(3)) def func5(grocery): for x in grocery: print(x) groc...
numb = int(input('digite um numero: ')) result = numb%2 if result == 0: print(f'{numb} e \033[0;34;0mPAR') else: print(f'{numb} e \033[0;33;0mIMPAR')
numb = int(input('digite um numero: ')) result = numb % 2 if result == 0: print(f'{numb} e \x1b[0;34;0mPAR') else: print(f'{numb} e \x1b[0;33;0mIMPAR')
lz = list('Alamakota') print(lz.index('a')) print(lz.index('m')) print(lz.index('k')) print() tab = [] for n in range(30+1): tab.append(3**n - 2**n) print(tab) print() print(tab.index(1161737179)) print() print(3**19-2**19)
lz = list('Alamakota') print(lz.index('a')) print(lz.index('m')) print(lz.index('k')) print() tab = [] for n in range(30 + 1): tab.append(3 ** n - 2 ** n) print(tab) print() print(tab.index(1161737179)) print() print(3 ** 19 - 2 ** 19)
message: dict = { 'TrackingID': str, 'MessageType': str, 'Duration': int, 'Host': str, 'Node': str, 'ClientHost': str, 'BackendSystem': str, 'BackendMethod': str, 'FrontendMethod': str, 'BackendServiceName': str, 'ApplicationName': str, 'ServiceVersion': str, 'StartDa...
message: dict = {'TrackingID': str, 'MessageType': str, 'Duration': int, 'Host': str, 'Node': str, 'ClientHost': str, 'BackendSystem': str, 'BackendMethod': str, 'FrontendMethod': str, 'BackendServiceName': str, 'ApplicationName': str, 'ServiceVersion': str, 'StartDateTime': str, 'EndDateTime': str, 'Aspects': str, 'Qu...
# https://leetcode.com/problems/valid-parentheses/ class Solution: # ---- In-place Solution def isMatch(self, s1: str, s2: str) -> bool: if s1 == "(" and s2 == ")": return True if s1 == "[" and s2 == "]": return True if s1 == "{" and s2 == "}": return True return False ...
class Solution: def is_match(self, s1: str, s2: str) -> bool: if s1 == '(' and s2 == ')': return True if s1 == '[' and s2 == ']': return True if s1 == '{' and s2 == '}': return True return False def solve_inplace(self, s: str): l = li...
a = 0 def foo(): global a a = 1
a = 0 def foo(): global a a = 1
def inorder(node): if not node: return yield from inorder(node.left) yield node yield from inorder(node.right)
def inorder(node): if not node: return yield from inorder(node.left) yield node yield from inorder(node.right)
string = m = [] while string != 'end': string = input() m.append(list(map(int, string.split(' ')))) if string != 'end' else None li, lj = len(m), len(m[0]) new = [[sum([m[i-1][j], m[(i+1)%li][j], m[i][j-1], m[i][(j+1)%lj]]) for j in range(lj)] for i in range(li)] [print(' '.join(map(str, row))) for row in new]
string = m = [] while string != 'end': string = input() m.append(list(map(int, string.split(' ')))) if string != 'end' else None (li, lj) = (len(m), len(m[0])) new = [[sum([m[i - 1][j], m[(i + 1) % li][j], m[i][j - 1], m[i][(j + 1) % lj]]) for j in range(lj)] for i in range(li)] [print(' '.join(map(str, row))) ...
alphabet = string.ascii_lowercase filepath = 'data/gutenberg.txt' TEXT = open(filepath).read() def tokens(text): words = re.findall('[a-z]+',text.lower()) return words WORDS = tokens(TEXT) COUNTS = Counter(WORDS) data = open("data/count_1w.txt",'w') for i in COUNTS: data.write(i+'\t'+str(COUNTS[i])+'\n'...
alphabet = string.ascii_lowercase filepath = 'data/gutenberg.txt' text = open(filepath).read() def tokens(text): words = re.findall('[a-z]+', text.lower()) return words words = tokens(TEXT) counts = counter(WORDS) data = open('data/count_1w.txt', 'w') for i in COUNTS: data.write(i + '\t' + str(COUNTS[i]) +...
def test_ping(test_app): response = test_app.get("/ping") assert response.status_code == 200 assert response.json() == {"ping":"pong!"} def test_foo(test_app): response = test_app.get("/foo") assert response.status_code == 200 assert response.json() == {"foo":"bar!"}
def test_ping(test_app): response = test_app.get('/ping') assert response.status_code == 200 assert response.json() == {'ping': 'pong!'} def test_foo(test_app): response = test_app.get('/foo') assert response.status_code == 200 assert response.json() == {'foo': 'bar!'}
class Solution: def findMinHeightTrees(self, n: int, edges: List[List[int]]) -> List[int]: if n <= 0: return [] if n == 1: return [0] graph = collections.defaultdict(set) for u, v in edges: graph[u].add(v) graph[v].add(u) queue = collections.deque() ...
class Solution: def find_min_height_trees(self, n: int, edges: List[List[int]]) -> List[int]: if n <= 0: return [] if n == 1: return [0] graph = collections.defaultdict(set) for (u, v) in edges: graph[u].add(v) graph[v].add(u) ...
# -*- coding: utf-8 -*- def urldecode(res): return dict([data.split('=') for data in res.split('&') if True])
def urldecode(res): return dict([data.split('=') for data in res.split('&') if True])
# Filter some words user_filter = input().split(' ') user_text = input() for cur_filter in user_filter: user_text = user_text.replace(cur_filter, '*' * len(cur_filter)) print(user_text)
user_filter = input().split(' ') user_text = input() for cur_filter in user_filter: user_text = user_text.replace(cur_filter, '*' * len(cur_filter)) print(user_text)
class ProgramName: def __init__(self, name, value): self.name = name self.value = value def __lt__(self, other): return self.value < other.value def __le__(self, other): return self.value <= other.value def __eq__(self, other): return self.value == other.val...
class Programname: def __init__(self, name, value): self.name = name self.value = value def __lt__(self, other): return self.value < other.value def __le__(self, other): return self.value <= other.value def __eq__(self, other): return self.value == other.value...
# # PySNMP MIB module DLINK-3100-CDB-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DLINK-3100-CDB-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:33:07 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, constraints_intersection, single_value_constraint, value_size_constraint) ...
def insertion_sort(list): result = list[:1] list.pop(0) while len(list) != 0: currentIndex = len(result) - 1 while currentIndex >= 0 and list[0] < result[currentIndex]: currentIndex -= 1 result.insert(currentIndex + 1, list[0]) list.pop(0) return result nums ...
def insertion_sort(list): result = list[:1] list.pop(0) while len(list) != 0: current_index = len(result) - 1 while currentIndex >= 0 and list[0] < result[currentIndex]: current_index -= 1 result.insert(currentIndex + 1, list[0]) list.pop(0) return result nums...
n = int(input()) l = list(map(int, input().split(" "))) minTemp = 999999 mini = 0 for i in range(n-2): temp = max(l[i], l[i+2]) if temp < minTemp: minTemp = temp mini = i print(mini+1, minTemp)
n = int(input()) l = list(map(int, input().split(' '))) min_temp = 999999 mini = 0 for i in range(n - 2): temp = max(l[i], l[i + 2]) if temp < minTemp: min_temp = temp mini = i print(mini + 1, minTemp)
def get_tag(tag, body): arr = [] tmp_body = body while True: idx = tmp_body.find("<"+tag) if -1 == idx: return arr id_end = tmp_body.find(">") arr.append(tmp_body[idx:id_end+1]) tmp_body = tmp_body[id_end+1:]
def get_tag(tag, body): arr = [] tmp_body = body while True: idx = tmp_body.find('<' + tag) if -1 == idx: return arr id_end = tmp_body.find('>') arr.append(tmp_body[idx:id_end + 1]) tmp_body = tmp_body[id_end + 1:]
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param head, a ListNode # @return a ListNode def insertionSortList(self, head): if not head: return head helper = ListNode(0)...
class Solution: def insertion_sort_list(self, head): if not head: return head helper = list_node(0) helper.next = cur = head while cur.next: if cur.next.val < cur.val: pre = helper while pre.next.val < cur.next.val: ...
def makeArrayConsecutive2(statues): count = 0 for i in range(min(statues), max(statues)): if i not in statues: count += 1 return count
def make_array_consecutive2(statues): count = 0 for i in range(min(statues), max(statues)): if i not in statues: count += 1 return count