content
stringlengths
7
1.05M
def get_landscape(region): """Takes the region and returns the correct landscape name Args: region (str): a AWS region name, such as 'eu-west-1' Returns: String """ return { 'us-east-1': 'na', 'eu-central-1': 'eu', 'eu-west-1': 'uk' }.get(region, 'eu') ...
def line(a, b): def para(x): return a * x + b return para def count(x=0): def incre(): nonlocal x x += 1 return x return incre def my_avg(): data = list() def add(num): data.append(num) return sum(data)/len(data) return add if __name__ =...
class Solution: def monotoneIncreasingDigits(self, n: int) -> int: if n < 10: return n break_point = None digits = [int(el) for el in str(n)] for i in range(len(digits) - 1): if digits[i] > digits[i + 1]: break_point = i break ...
"""Class for handling strings""" def str2bin(msg): """Convert a binary string into a 16 bit binary message.""" assert isinstance(msg, bytes), 'must give a byte obj' return ''.join([bin(c)[2:].zfill(16) for c in msg]).encode() def bin2str(binary): """Convert biary 16 bit binary message into a string ...
""" Представлен список чисел. Определить элементы списка, не имеющие повторений. Сформировать итоговый массив чисел, соответствующих требованию. Элементы вывести в порядке их следования в исходном списке. Для выполнения задания обязательно использовать генератор. Пример исходного списка: [2, 2, 2, 7, 23, 1, 44, 44, 3, ...
# -*- coding:utf-8 -*- # author: exchris # description: 今日头条文章python面试必考题(未知) # 下面这段代码的输出结果是什么 def extendList(val, lst=[]): lst.append(val) return lst list1 = extendList(10) list2 = extendList(123,[]) list3 = extendList('a') """ print("list1 = %s" % list1) print("list2 = %s" % list2) print("list3 = %s" % li...
begin = """#include "riscv_test.h" RVTEST_CODE_BEGIN """ middle = """ RVTEST_PASS RVTEST_CODE_END .data RVTEST_DATA_BEGIN""" end = """RVTEST_DATA_END""" put_str = """la a1, str{} jal put_str la a1, str_crlf jal put_str """ dot_string = '''str{}: .string "{:x}"''' num = 10 print(begin) for i in range(num): ...
crypt_words = input().split() for word in crypt_words: first_number = "" second_part = "" for letter in word: if 48 <= ord(letter) <= 57: first_number += letter else: second_part += letter first_letter = chr(int(first_number)) half = first_letter + second_par...
# 🚨 Don't change the code below 👇 two_digit_number = input("Type a two digit number: ") # 🚨 Don't change the code above 👆 #################################### #Write your code below this line 👇 a = int(two_digit_number[0]) b = int(two_digit_number[1]) print(a+b)
class ExportBase: """ Base class to be inherited from other modules to export from the online model. It just provides that in writeLine of LineContainer Module always an event handler function is called """ def __init__(self): self.switch = 0 self.path = '' self.avoidPreset =...
PDAC_MODES = { "debug" : { "session-id" : "debug", "sources" : { "audio" : { "active" : False }, "video" : { "active" : True }, "heartrate" : { "active" : False }, }, "inference" : None, "transform" : False, "sinks" : { ...
# error lib? def typeError(expected, value): raise TypeError('expected \n |> %s \n but found \n |> %s' % (expected, type(value)))
n = int(input()) ar = list(map(int, input().split())) print(ar.count(max(ar)))
def main(): name = "John Doe" age = 40 print("The user's name is", name, "and his/her age is", age, end=".\n") print("Next year he/she will be", age+1, "years old.", end="\n\n") print("The characters of the user's name are:") for i in range(len(name)): print(name[i].upper(), end=" ")...
a = input() b = int(input()) def calculate_price(product, qty): PRICE_LIST = { "coffee": 1.50, "water": 1.00, "coke": 1.40, "snacks": 2.00 } return '{:.2f}'.format(PRICE_LIST[product] * qty) print(calculate_price(a, b))
class JsonRPCError(Exception): def __init__(self, request_id, code, message, data, is_notification=False): super().__init__(message) self.request_id = request_id self.code = code self.message = message self.data = data self.is_notification = is_notification def f...
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # author: bigfoolliu """ 二叉树相关算法以及实现 一个中心,两个基本点,三种题型,四个重要概念,七个技巧。 一个中心 - 树的遍历,即将所有的节点都要访问一遍 两个基本点 - 深度优先遍历(DFS),又细分为前中后序遍历,属于盲目遍历 - 广度优先遍历(BFS),其中又分为'带层'和'不带层',核心在于求最短距离的时候可以提前终止,采用横向搜索的方式,数据结构上通常使用队列 注意:广度遍历不是层次遍历,层次遍历是一种不需要提前终止的广度遍历的副产物 三种题型 - 搜索类...
# # Sets (kopas) # # unordered # # unique items # # use: get rid of duplicates, membership testing # # https://docs.python.org/3/tutorial/datastructures.html#sets # # https://realpython.com/python-sets/ # chars = set("abracadabra") # you pass an iterable to set(iterablehere) # print(chars) # print(len(chars)) # print...
def menu(): """ Handles the displaying of the main menu """ print('// Main Menu: ') print('1. Teams') print('2. Players') print('0. Exit') def teams_menu(): """ Handles the displaying of the teams menu """ print('// Teams Menu: ') print('1. Display basic team info') print('2. Displa...
largura = float(input('insira a largura da parede: ')) altura = float(input('insira a altura da parede: ')) m2 = largura * altura tinta = m2/2 print('sua parede tem dimensão de {}x{} e sua área é de {}m²'.format(largura, altura, m2)) print('para pintar sua parede você precisa de {}l de tinta'.format(tinta))
class Skill: def __init__(self, skill_data: dict): self.id = skill_data['id'] self.name = skill_data['skill_name'] self.explain = skill_data['explain'] self.en_explain = skill_data['explain_en'] self.skill_type = skill_data['skill_type'] self.judge_type = skill_data[...
#!/usr/bin/env python # -*- coding: utf-8 -*- spinMultiplicity = 2 energy = { 'BMK/cbsb7': GaussianLog('CH3bmk.log'), 'CCSD(T)-F12/cc-pVTZ-F12': MolproLog('CH3bmk_f12.out'), } frequencies = GaussianLog('CH3bmkfreq.log') rotors = []
#!/usr/bin/env python3 # set Blinkt! brightness, IT BURNS MEEEEEE, 100 is the max BRIGHTNESS = 10 # define colour values for Blinkt! LEDs. Edit as you please... COLOUR_MAP = { 'level6': { 'r': 155, 'g': 0, 'b': 200, 'name': 'magenta' }, 'level5': { 'r': 255, 'g': 0, 'b': 0, 'name': 'red' }, ...
# -*- coding: utf-8 -*- DESC = "faceid-2018-03-01" INFO = { "GetDetectInfo": { "params": [ { "name": "BizToken", "desc": "人脸核身流程的标识,调用DetectAuth接口时生成。" }, { "name": "RuleId", "desc": "用于细分客户使用场景,由腾讯侧在线下对接时分配。" }, { "name": "InfoType", "...
class Solution: def largestRectangleArea(self, heights: list[int]) -> int: heights.append(0) stack: list[int] = [-1] ans = 0 for i, h in enumerate(heights): while stack and h <= heights[stack[-1]]: curH = heights[stack.pop()] if not stack: ...
# Problem: Decode Ways # Difficulty: Medium # Category: String, DP # Leetcode 91: https://leetcode.com/problems/decode-ways/discuss/ """ A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded message containing digits, determine th...
def solve(x: int) -> int: x = y # err z = x + 1 return y # err
number = int(input()) counter = int(input()) number_add = number list_numbers = [number] for i in range(counter - 1): number_add += number list_numbers.append(number_add) print(list_numbers)
# range pode receber até 3 parâmetros # Apenas 1 parâmetro diz que a variável vai de 0 até o valor estipulado (-1) arr1 = range(5) # 0, 1, 2, 3, 4 # Se utilizar dois argumentos, o primeiro será o início e o segundo o fim do arranjo arr2 = range(2, 6) # 2, 3, 4, 5 # O terceiro argumento é o espaçamento do arranjo arr...
# Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. # Example 1: # Input: "Let's take LeetCode contest" # Output: "s'teL ekat edoCteeL tsetnoc" class Solution(object): def reverseWords(self, s): """ ...
def plot_data(data, ax, keys=None, width=0.5, colors=None): if keys is None: keys = ['Latent Test error', 'Test Information Loss'] if colors is None: colors = ['blue', 'red'] for i, entry in enumerate(data): h1 = entry[keys[0]] h2 = h1 + entry[keys[1]] ax.fill_betwee...
#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause # # Constants for MIDI notes. # # For example: # F# in Octave 3: O3.Fs # C# in Octave -2: On2.Cs # D-flat in Octave 1: O1.Db # D in Octave 0: O0.D # E in Octave 2: O2.E class Octave: def __init__(self, base): ...
class Task: def __init__(self, id, title): self.title = title self.id = id self.status = "new"
""" Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-value...
a = int(input('Digite um valor: ')) b = int(input('Digite outro valor: ')) c = int(input('Digite mais um valor: ')) lixta = [a, b, c] lixta.sort() print(f'O maior valor é: {lixta[2]}') print(f'o menor valor é: {lixta[0]}')
def problem(a): try: return float(a) * 50 + 6 except ValueError: return "Error"
class AccountInfo(): def __init__(self, row_id, email, password, cookies, status_id): self.row_id = row_id self.email = email self.password = password self.cookies = cookies self.status_id = status_id def __repr__(self): return f"id: {self.row_id}, email: {self...
class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: """ Given an array of integers numbers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. Return the indices of the two numb...
""" coding: utf-8 Created on 17/11/2020 @author: github.com/edrmonteiro From: Hackerrank challenges Language: Python Title: Sorting: Bubble Sort Consider the following version of Bubble Sort: for (int i = 0; i < n; i++) { for (int j = 0; j < n - 1; j++) { // Swap adjacent elements if they are in dec...
""" day7-part1.py Created on 2020-12-07 Updated on 2020-12-20 Copyright © Ryan Kan """ # INPUT rules = {} with open("input.txt", "r") as f: lines = [line.strip()[:-1] for line in f.readlines()] rawRules = [[[y.split(" ")[:-1] for y in x.split(", ")] for x in line.split(" contain ")] for line in lines] f...
class ssdict: def __init__(self, ss, param, collectiontype): factory = { 'projects': self.getProjects, 'reviews': self.getReviews, 'items': self.getItems, 'comments': self.getComments, } func = factory[collectiontype] self.collection = ...
# Preços de água para cada faixa de consumo agua_residencial_normal = {10: 2.79, 15:3.61, 20:3.92, 50:6.71, "inf": 11.86} esgoto_residencial_normal = {10: 3.09, 15:3.97, ...
# # PySNMP MIB module CISCOSB-ippreflist-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCOSB-ippreflist-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:08:08 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
""" Raincoat comments that are checked in acceptance tests """ def simple_function(): # Raincoat: pypi package: raincoat==0.1.4 path: raincoat/_acceptance_test.py element: use_umbrella # noqa # Raincoat: pypi package: raincoat==0.1.4 path: raincoat/_acceptance_test.py element: Umbrella.open # noqa # Rai...
# Programa que calcule o preço a pagar pelo aluguel do carro # Tendo as seguintes regras: # R$: 60 por dia # R$: 0,15 por km rodado try: dias = int(input("Informe quantos dias o carro foi alugado: ")) km = float(input("Informe quantos km foi rodado: ")) preco = (dias * 60) + (km * 0.15) print(f"O preço ...
""" Day 3 - Maximum Subarray LeetCode Easy Problem Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Input: [-2,1,-3,4,-1,2,1,-5,4], Output: 6 Explanation: [4,-1,2,1] has the largest sum = 6. Follow up: If you ...
class c_iterateur(object): def __init__(self, obj): self.obj = obj self.length = len(obj) self.count = 0 def __iter__(self): return self def next(self): if self.count > self.length: raise StopIteration else: result = self.obj[self.co...
# input number of strings in the set N = int(input()) trie = {} end = object() # input the strings for _ in range(N): s = input() t = trie for c in s[:-1]: if c in t: t = t[c] else: t[c] = {} t = t[c] # Print GOOD SET if the set is valid else, outp...
# Google Kickstart 2019 Round: Practice def solution(N, K, x1, y1, C, D, E1, E2, F): alarmList = [] alarmPowermap = [[] for i in range(K)] alarmPower = 0 # Calculate alarmList element = (x1 + y1) % F xPrev, yPrev = x1, y1 alarmList.append(element) for _ in range(N-1): xi = (C*...
# -*- coding: utf-8 -*- """ Created on Tue Aug 11 19:22:52 2020 @author: abhi0 """ class Solution: def setZeroes(self, matrix: List[List[int]]) -> None: """ Do not return anything, modify matrix in-place instead. """ temp=[] tempPrime=[] for ...
thistuple = ("apple", "banana", "cherry") print(thistuple) thistuple = ("apple", "banana", "cherry") print(thistuple[1]) thistuple = ("apple", "banana", "cherry") print(thistuple[-1]) thistuple = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango") print(thistuple[2:5]) x = ("apple", "banana", "che...
def test_response_protocol_with_http1_0_request_(): pass def test_response_protocol_with_http1_1_request_(): pass def test_response_protocol_with_http1_1_request_and_http1_0_server(): pass def test_response_protocol_with_http0_9_request_(): pass def test_response_protocol_with_http2_0_request_(): pass
# -*- coding: utf-8 -*- """Version information for :mod:`seffnet`.""" __all__ = [ 'VERSION', ] VERSION = '0.0.1-dev'
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 25 18:24:38 2017 @author: dhingratul P 1.1 """ def isUnique(s): s2=s.upper() l=set(list(s2)) if len(l) == len(s2): return True else: return False # Main program print(isUnique("ABCc"))
plain_text = list(input("Enter plain text:\n")) encrypted_text = [] original_text = [] for char in plain_text: encrypted_text.append(chr(ord(char)+5)) for char in encrypted_text: original_text.append(chr(ord(char)-5)) print(encrypted_text) print(original_text)
''' Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Input: [-2,1,-3,4,-1,2,1,-5,4], Output: 6 Explanation: [4,-1,2,1] has the largest sum = 6. Follow up: If you have figured out the O(n) solution, try coding another sol...
POSSIBLE_MARKS = ( ("4", "4"), ("5", "5"), ("6", "6"), ("7", "7"), ("8", "8"), ("9", "9"), ("10", "10"), )
# # PySNMP MIB module IPAD-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IPAD-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:44:34 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1...
distancia = float(input('Digite a distancia em KM da viagem: ')) passag1 = distancia * 0.5 passag2 = distancia * 0.45 if distancia <= 200: print('Sua passagem vai custar R${:.2f}'.format(passag1)) else: print('Sua passagem vai custar R${:.2f}'.format(passag2))
f=float(8.11) print(f) i=int(f) print(i) j=7 print(type(j)) j=f print(j) print(type(j)) print(int(8.6))
def _impl(ctx): name = ctx.attr.name deps = ctx.attr.deps suites = ctx.attr.suites visibility = None # ctx.attr.visibility suites_mangled = [s.partition(".")[0].rpartition("/")[2] for s in suites] for s in suites_mangled: native.cc_test( name = "{}-{}".format(name, s), ...
while True: budget = float(input("Enter your budget : ")) available=budget break d ={"name":[], "quantity":[], "price":[]} l= list(d.values()) name = l[0] quantity= l[1] price = l[2] while True: ch = int(input("1.ADD\n2.EXIT\nEnter your choice : ")) if ch == 1 and...
data="7.dat" s=0.0 c=0 with open(data) as fp: for line in fp: words=line.split(':') if(words[0]=="RMSE"): c+=1 # print(words[1]) s+=float(words[1]) # print(s) print("average:") print(s/c)
if __name__ == '__main__': n = int(input()) for num in range(n): print(num * num)
# # PySNMP MIB module ONEACCESS-CONFIGMGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ONEACCESS-CONFIGMGMT-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:34:15 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7....
coco_keypoints = [ "nose", # 0 "left_eye", # 1 "right_eye", # 2 "left_ear", # 3 "right_ear", # 4 "left_shoulder", # 5 "right_shoulder", # 6 "left_elbow", # 7 ...
#!/usr/bin/env python3 # https://codeforces.com/problemset/problem/675/A # 注意c可以是0或负数! def f(l): a,b,c = l if c==0: return a==b return (b-a)%c==0 and (b-a)//c>=0 l = list(map(int,input().split())) print('YES' if f(l) else 'NO')
# Return tracebacks with OperationOutcomes when an exceprion occurs DEBUG = False # How many items should we include in budles whwn count is not specified DEFAULT_BUNDLE_SIZE = 20 # Limit bundles to this size even if more are requested # TODO: Disable limiting when set to 0 MAX_BUNDLE_SIZE = 100 # Path to the models...
peso = float(input('Digite o peso da pessoa \t')) engorda = peso + (peso*0.15) emagrece = peso - (peso*0.20) print('Se engordar , peso = ',engorda) print('Se emagrece , peso = ',emagrece)
#conditional tests- testing for equalities sanrio_1 = 'keroppi' print("Is sanrio == 'keroppi'? I predict True.") print(sanrio_1 == 'keroppi') sanrio_2 = 'hello kitty' print("Is sanrio == 'Hello Kitty'? I predict True.") print(sanrio_2 == 'hello kitty') sanrio_3 = 'pochacco' print("Is sanrio == 'Pochacco'? I...
num =int(input(" Input a Number: ")) def factorsOf(num): factors=[] for i in range(1,num+1): if num%i==0: factors.append(i) print(factors) factorsOf(num)
# A non-empty array A consisting of N integers is given. The array contains an odd number of elements, and each element of the array can be paired with another element that has the same value, except for one element that is left unpaired. # Write a function: that, given an array A consisting of N integers fulfilling t...
# Find which triangle numbers and which square numbers are the same # Written: 13 Jul 2016 by Alex Vear # Public domain. No rights reserved. STARTVALUE = 1 # set the start value for the program to test ENDVALUE = 1000000 # set the end value for the program to test for num in range(STARTVALUE, ENDVALUE): sqr...
class Solution: def missingNumber(self, nums: List[int]) -> int: l = len(nums) return l * (1 + l) // 2 - sum(nums)
def quick_sort(data: list, first: int, last: int): if not isinstance(data, list): print(f'The data {data} MUST be of type list') return if not isinstance(first, int) or not isinstance(last, int): print(f'The args {first}, and {last} MUST be an index') return if first <...
# ------------------------------ # 42. Trapping Rain Water # # Description: # Given n non-negative integers representing an elevation map where the width of each # bar is 1, compute how much water it is able to trap after raining. # (see picture on the website) # # Example: # Input: [0,1,0,2,1,0,1,3,2,1,2,1] # Outpu...
# 并查集的代码模板 class UnionFind: def __init__(self, n: int): self.count = n self.parent = [i for i in range(n)] def find(self, p: int): temp = p while p != self.parent[p]: p = self.parent[p] while temp != self.parent[p]: temp, self.parent[temp] ...
# Scaler problem def solve(s, queries): left_most = [-1] * len(s) index = -1 for i in range(len(s) - 1, -1, -1): if s[i] == '1': index = i left_most[i] = index right_most = [-1] * len(s) index = -1 for i in range(len(s)): if s[i] == '1': index = ...
class Solution(object): def majorityElement(self, nums): """ :type nums: List[int] :rtype: int """ hashmap = {} for num in nums: hashmap[num] = hashmap.setdefault(num, 0) + 1 max_value = -sys.maxint majority_element = None for num ...
def getime(date): list1=[] for hour in range(8): for minute in range(0,56,5): if minute<10: time=str(date)+'-0'+str(hour)+':0'+str(minute)+':01' else: time=str(date)+'-0'+str(hour)+':'+str(minute)+':01' list1.append(time) for hour in range(8,24): if hour<10: for minute in range(0,60): if...
HASH_KEY = 55 WORDS_LENGTH = 5 REQUIRED_WORDS = 365 MAX_GAME_ATTEMPTS = 6 WORDS_PATH = 'out/palabras5.txt' GAME_HISTORY_PATH = 'out/partidas.json' GAME_WORDS_PATH = 'out/palabras_por_fecha.json'
#hyperparameter hidden_size = 256 # hidden size of model layer_size = 3 # number of layers of model dropout = 0.2 # dropout rate in training bidirectional = True # use bidirectional RNN for encoder use_attention = True # use attention between encoder-decoder batch_size = 8 # batch size in training workers = 4 # number...
class ProcessorResults(): """ This class is a intended to be used as a standard results class to store every results object to be needed in the Processor class. """ def __init__(self): self.all_tracks = {}
''' write a function to sort a given list and return sorted list using sort() or sorted() functions''' def sorted_list(alist): return sorted(alist) sorted_me = sorted_list([5,2,1,7,8,3,2,9,4]) print(sorted_me) def sort_list(alist): return alist.sort() sort_me = sort_list([5,2,1,7,8,3,2,9,4]) print(sort_me)
# https://www.interviewbit.com/problems/sorted-insert-position/ # Sorted Insert Position # Given a sorted array and a target value, # return the index if the target is found. If not, # return the index where it would be if it were inserted in order. # [1,3,5,6], 5 → 2 # [1,3,5,6], 2 → 1 # [1,3,5,6], 7 → 4 # [1,3,5,6...
class Solution: def convert(self, s, numRows): """ :type s: str :type numRows: int :rtype: str """ if numRows == 1: return s else: p = [] placeholder = [] for _ in range(numRows): placeholder.appe...
""" Дана последовательность натуральных чисел, завершающаяся числом 0. Определите, какое наибольшее число подряд идущих элементов этой последовательности равны друг другу и что это за элемент. Т.е. если программе на вход подать последовательность [1, 2, 2, 3, 7, 4, 4, 4, 0, 5, 5, 5], то на печать программа должна вывес...
# Parent key is matching the django language. # Child key is matching the VeeValidate lang codes # https://logaretm.github.io/vee-validate/guide/localization.html#using-the-default-i18n vv_locale = { "ar": { "ar": { "messages": { "alpha": "{_field_} يجب ان يحتوي على حروف فقط", ...
class Solution: """ Note: for UnionFind structure, see Structures/UnionFind/uf.py. """ def findRedundantConnection(self, edges: List[List[int]]) -> List[int]: # Yes, goes from 0-n+1 but we don't use 0. uf = UnionFind(range(len(edges)+1)) last = None for (u, v) in edges: ...
def extractXiakeluojiao侠客落脚(item): """ Xiakeluojiao 侠客落脚 """ badwords = [ 'korean drama', 'badword', ] if any([bad in item['tags'] for bad in badwords]): return None vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol or frag) or 'preview' in item['title'...
def solution(A): h = set(A) l = len(h) for i in range(1, l+1): if i not in h: return i return -1 # final check print(solution([1, 2, 3, 4, 6]))
class BitmaskPrinter: bitmask_object_template = '''/* Autogenerated Code - do not edit directly */ #pragma once #include <stdint.h> #include <jude/core/c/jude_enum.h> #ifdef __cplusplus extern "C" { #endif typedef uint%SIZE%_t %BITMASK%_t; extern const jude_bitmask_map_t %BITMASK%_bitmask_map[]; #ifdef __cplus...
# -------------------------------------------------- class: AddonInstallSettings ------------------------------------------------- # class AddonInstallSettings: # --------------------------------------------------------- Init --------------------------------------------------------- # def __init__( s...
''' Description: You are given the root of a binary tree with n nodes, where each node is uniquely assigned a value from 1 to n. You are also given a sequence of n values voyage, which is the desired pre-order traversal of the binary tree. Any node in the binary tree can be flipped by swapping its left and right sub...
""" b = [int(x) for x in input().split()] del b[0] prefix = 0 suffix = 0 ans = 0 for n in range(len(b)): prefix += b[n] suffix += b[-n-1] if prefix == suffix: ans += 1 print(ans) """ a = input() print(20156 if a.startswith('1') else 1)
# 计数器 flowFile = session.get() if flowFile != None: session.adjustCounter("SampleScriptCounter", 1, False) session.transfer(flowFile, REL_SUCCESS)
#!/usr/bin/env python3 """Utilities for building services in the Ride2Rail project.""" __version__ = '0.2.0' __all__ = ['cli_utils', 'cache_operations', 'logging', 'normalization']
#!/usr/bin/env python3 # -*- coding: utf-8 -*- if __name__ == '__main__': Named = str(input(" Введите название футбольной команды ")) s = int(len(Named)) for i in range(s): print(Named[i])
installed_extensions = [ 'azext_identitydirmgt_v1_0', 'azext_planner_v1_0', 'azext_identitysignins_v1_0', 'azext_schemaextensions_v1_0', 'azext_mail_v1_0', 'azext_files_v1_0', 'azext_notes_v1_0', 'azext_crossdeviceexperiences_v1_0', 'azext_cloudcommunications_v1_0', 'azext_directoryobjects_v1_0', 'azext_users...
# Fields for the tables generated from the mysql dump table_fields = {"commits": [ "author_id", "committer_id", "project_id", "created_at" ], "counters": [ "id", ...