content
stringlengths
7
1.05M
array = [0,0,1,1,1,1,2,2,2,2,3,3] indexEqualCurrentUsage = [] for index in range(len(array)): if array[index] == 1: indexEqualCurrentUsage.append(index) print(indexEqualCurrentUsage)
""" We see many sharp peaks in the training set, but these peaks are not always present in the test set, suggesting that they are due to noise. Therefore, ignoring this noise, we might have expected the neural responses to be a sum of only a few different filters and only at a few different positions. This would mean ...
### do not use these settings and passwords for production! # these settings are required to connect the postgres-db to metabase POSTGRES_USER='postgres' POSTGRES_PASSWORD='1234' POSTGRES_HOST='postgresdb' POSTGRES_PORT='5432' POSTGRES_DB_NAME='postgres'
def leiaInt(mgn): while True: try: n = int(input(mgn)) except (ValueError, TypeError): print('\033[031mErro: por favor, digite um número interio válido.\033[m') else: return n break def leiaFloat(mgn): while True: try: ...
# # Sunny data # outFeaturesPath = "models/features_40_sun_only" # outLabelsPath = "models/labels_sun_only" # imageFolderName = 'IMG_sun_only' # features_directory = '../data/' # labels_file = '../data/driving_log_sun_only.csv' # modelPath = 'models/MsAutopilot_sun_only.h5' # NoColumns = 3 # steering value index in csv...
with open('inputs/input2.txt') as fin: raw = fin.read() def parse(raw): start = [(x[:3], int(x[4:])) for x in (raw.split('\n'))] return start a = parse(raw) def part_1(arr): indices = set() acc = 0 i = 0 while i < len(arr): pair = arr[i] if i in indices: bre...
################################ A Library of Functions ################################## ################################################################################################## #simple function which displays a matrix def matrixDisplay(M): for i in range(len(M)): for j in range(len...
class Solution: def sumNumbers(self, root: Optional[TreeNode]) -> int: def DFS(root): if not root: return 0 if not root.left and not root.right : return int(root.val) if root.left: root.left.val = 10 * root.val + root.left.val if root.right: root.right.val = 1...
# Copyright (c) 2010-2022 openpyxl """ List of builtin formulae """ FORMULAE = ("CUBEKPIMEMBER", "CUBEMEMBER", "CUBEMEMBERPROPERTY", "CUBERANKEDMEMBER", "CUBESET", "CUBESETCOUNT", "CUBEVALUE", "DAVERAGE", "DCOUNT", "DCOUNTA", "DGET", "DMAX", "DMIN", "DPRODUCT", "DSTDEV", "DSTDEVP", "DSUM", "DVAR", "DVARP", "DATE", "D...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (c) 2021, Cisco Systems # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) DOCUMENTATION = r""" --- module: network_device short_description: Resource module for Network Device description: - Manage operations create, upda...
class OrderCodeAlreadyExists(Exception): pass class DealerDoesNotExist(Exception): pass class OrderDoesNotExist(Exception): pass class StatusNotAllowed(Exception): pass
# -*- coding: utf-8 -*- # Copyright (c) 2017-18 Richard Hull and contributors # See LICENSE.rst for details. _DIGITS = { ' ': 0x00, '-': 0x01, '_': 0x08, '\'': 0x02, '0': 0x7e, '1': 0x30, '2': 0x6d, '3': 0x79, '4': 0x33, '5': 0x5b, '6': 0x5f, '7': 0x70, '8': 0x7f, ...
"""Hex Grid, by Al Sweigart al@inventwithpython.com Displays a simple tessellation of a hexagon grid. This and other games are available at https://nostarch.com/XX Tags: tiny, beginner, artistic""" __version__ = 0 # Set up the constants: # (!) Try changing these values to other numbers: X_REPEAT = 19 # How many times ...
class FlameTextEdit(QtWidgets.QTextEdit): """ Custom Qt Flame Text Edit Widget To use: text_edit = FlameTextEdit('some_text_here', True_or_False, window) """ def __init__(self, text, read_only, parent_window, *args, **kwargs): super(FlameTextEdit, self).__init__(*args, **kwargs) ...
# -*- coding: utf-8 -*- # 服务市场服务 class MarketService: __client = None def __init__(self, client): self.__client = client def sync_market_messages(self, start, end, offset, limit): """ 同步某一段时间内的服务市场消息 :param start:开始时间 :param end:结束时间 :param offset:消息偏移量 ...
# merge sort # h/t https://www.thecrazyprogrammer.com/2017/12/python-merge-sort.html # h/t https://www.youtube.com/watch?v=Nso25TkBsYI def merge_sort(array): n = len(array) if n > 1: mid = n//2 left = array[0:mid] right = array[mid:n] print(mid, left, right, array) ...
def ATWGetListKeyTxt(KeyTxt,List,NewTxt,sel): global ATWGetListKeyTxt0 global ATWGetListKeyTxt1Nb ATWGetListKeyTxt0 = [] ATWGetListKeyTxt0.clear() if sel == 'LGT': # kw = List 中所有 for kw in List: # 如 關鍵字在 add list if KeyTxt in kw: ...
# Lucas Sequence Using Recursion def recur_luc(n): if n == 1: return n if n == 0: return 2 return (recur_luc(n-1) + recur_luc(n-2)) limit = int(input("How many terms to include in Lucas series:")) print("Lucas series:") for i in range(limit): print(recur_luc(i))
# encoding: utf-8 """Exceptions used by marrow.mailer to report common errors.""" __all__ = [ 'MailException', 'MailConfigurationException', 'TransportException', 'TransportFailedException', 'MessageFailedException', 'TransportExhaustedException', 'ManagerExcep...
# # PySNMP MIB module RBN-SYS-SECURITY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RBN-SYS-SECURITY-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:53:26 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
lines = open('input.txt').read().splitlines() matches = {'(': ')', '[': ']', '{': '}', '<': '>'} penalty = {')': 3, ']': 57, '}': 1197, '>': 25137} costs = {')': 1, ']': 2, '}': 3, '>': 4} errors = [] incpl_costs = [] for i, l in enumerate(lines): expected_closings = [] for c in l: if c in matches.key...
# Time: O(n^2) # Space: O(1) # 892 # On a N * N grid, we place some 1 * 1 * 1 cubes. # # Each value v = grid[i][j] represents a tower of v cubes # placed on top of grid cell (i, j). # # Return the total surface area of the resulting shapes. # # Example 1: # # Input: [[2]] # Output: 10 # Example 2: # # Input: [[1,2],[...
# 1109. Corporate Flight Bookings # Weekly Contest 144 # Time: O(len(n)) # Space: O(n) class Solution: def corpFlightBookings(self, bookings: List[List[int]], n: int) -> List[int]: """ Shorter solution: """ res = [0]*(n+1) for i,j,k in bookings: res[i-1]+=k ...
# Given a sorted array of integers, find the starting and ending position of a given target value. # Your algorithm's runtime complexity must be in the order of O(log n). # If the target is not found in the array, return [-1, -1]. # For example, # Given [5, 7, 7, 8, 8, 10] and target value 8, # return [3, 4]. ...
# Foi colocado a função strip() no final da primeira linha para já garantir a eliminação dos espaços no começo # e final do nome caso alguém digite na hora de inserir o nome nome = str(input('Digite seu nome completo: ')).strip() print('\033[31mTodas as letras maiúsculas\033[m {}'.format(nome.upper())) print('\033[32mT...
# -*- coding: utf-8 -*- """ flaskbb.core.exceptions ~~~~~~~~~~~~~~~~~~~~~~~ Exceptions raised by flaskbb.core, forms the root of all exceptions in FlaskBB. :copyright: (c) 2014-2018 the FlaskBB Team :license: BSD, see LICENSE for more details """ class BaseFlaskBBError(Exception): ""...
class Solution(object): def romanToInt(self, s): """ :type s: str :rtype: int """ lm2int = {"I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000} s_len_num = len(s) ans = 0 # for i in range(s_len_num-1): # if lm...
name = input ("Please enter your name:\t") age = int(input ("how old are you, {0}? ".format(name))) if age > 100: print ("Nice Try 🙄 ") else: if age < 0: print ("I don`t beleve you.... as if your age is in minus (lol)") if age >= 18: print ("You are old enough vote (yay!) ") print...
# https://leetcode.com/problems/climbing-stairs/ # --------------------------------------------------- # Runtime Complexity: O(n) # Space Complexity: O(1) class Solution: def climbStairs(self, n: int) -> int: if n <= 2: return n prev_prev = 1 prev = 2 cur = 0 f...
""" Behavioral pattern: Iterator => 1.Iterable 2.Iteration Requirements that should know: __iter__ , __next__ """ class Iteration: def __init__(self, value): self.value = value def __next__(self): if self.value == 0: raise StopIteration('End of sequence') ...
def urlify(s, i): p1, p2 = len(s) - 1, i while p1 >= 0 and p2 >= 0: if s[p2] != " ": s[p1] = s[p2] else: for i in reversed("%20"): s[p1] = i p1 -= 1 p1 -= 1 p2 -= 1
# Leia o Salario de um funcionario e mostre seu novo salário, com 15% de aumento # vo = float(input('Salário = R$')) des = int(input('Aumento = ')) print(' ') des = des / 100 dg = vo * des vd = vo * (1 + des) print('Valor original: R${:.2f} \nAumento ganho: R${:.2f} \n Valor aumentado: R${:.2f}' .format(vo, dg, vd)...
# Example 1: # Input: candidates = [2,3,6,7], target = 7 # Output: [[2,2,3],[7]] # Explanation: # 2 and 3 are candidates, and 2 + 2 + 3 = 7. # Note that 2 can be used multiple times. # 7 is a candidate, and 7 = 7. # These are the only two combinations. # Example 2: # Input: candidates = [2,3,5], target = 8 # Output: [...
""" * Assignment: Type Int Time * Required: yes * Complexity: easy * Lines of code: 12 lines * Time: 8 min English: 1. Calculate how many seconds is one day (24 hours) 2. Calculate how many minutes is one week (7 days) 3. Calculate how many hours is in one month (31 days) 4. Calculate how many seconds ...
################################################# # Unit helpers # ################################################# class Length(float): unit2m = dict(mm=0.001, cm=0.01, dm=0.1, m=1, km=1000) def __new__(cls, val, unit): return float.__new__(cls, val) def __init...
#entrada resp = 'S' media = cont = maior = menor = 0 while resp == 'S': n = int(input('Digite um número: ')) #processamento media += n cont += 1 if cont == 1: maior = menor = n else: if n > maior: maior = n elif n < menor: menor = n resp...
command = input() student_ticket = 0 standard_ticket = 0 kid_ticket = 0 while command != "Finish": seats = int(input()) ticket_type = input() tickets_sold = 0 while seats > tickets_sold: tickets_sold += 1 if ticket_type == "student": student_ticket += 1 elif ticke...
META_SITE_DOMAIN = 'www.geocoptix.com' META_USE_OG_PROPERTIES = True META_USE_TWITTER_PROPERTIES = True META_TWITTER_AUTHOR = 'geocoptix' META_FB_AUTHOR_URL = 'https://facebook.com/geocoptix'
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
def extractMyFirstTimeTranslating(item): """ 'My First Time Translating' """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol or frag) or 'preview' in item['title'].lower(): return None return False
class Toggle_Button(QPushButton): sent_fix = pyqtSignal(bool, int, bool) def __init__(self, currentRowCount): QPushButton.__init__(self, "ON") # self.setFixedSize(100, 100) self.currentRowCount = self.rowCount() self.setStyleSheet("background-color: green") self.setChecka...
TBD = None img_norm_cfg = dict(mean=TBD, std=TBD, to_rgb=TBD) train_pipeline = TBD test_pipeline = TBD # dataset settings dataset_type = 'VOCDataset' data_root = 'data/VOCdevkit/' dataset_repeats = 10 data = dict( samples_per_gpu=TBD, workers_per_gpu=TBD, train=dict( type='RepeatDataset', ...
load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest") load( "//:coursier.bzl", "add_netrc_entries_from_mirror_urls", "compute_dependency_inputs_signature", "extract_netrc_from_auth_url", "get_coursier_cache_or_default", "get_netrc_lines_from_entries", "remove_auth_from_url", "sp...
# ------------------------------------------------------------------------------ # class Attributes (object) : # FIXME: add method sigs # -------------------------------------------------------------------------- # def __init__ (self, vals={}) : raise Exception ("%s is not implemented" % se...
class IdGenerator(object): number = 0 @staticmethod def next(): tmp = IdGenerator.number IdGenerator.number += 1 return str(tmp)
# Copyright (c) 2016 Vivaldi Technologies AS. All rights reserved { 'targets': [ { 'target_name': 'vivaldi_browser', 'type': 'static_library', 'dependencies': [ 'app/vivaldi_resources.gyp:*', 'chromium/base/base.gyp:base', 'chromium/components/components.gyp:search_engine...
# Definition for singly-linked list. class ListNode(object): def __init__(self, val=0, next=None): self.val = val self.next = next class Solution(object): def rotateRight(self, head, k): """ :type head: ListNode :type k: int :rtype: ListNode """ ...
# Copyright 2021 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# -*- coding: utf-8 -*- """ 1287. Element Appearing More Than 25% In Sorted Array Given an integer array sorted in non-decreasing order, there is exactly one integer in the array that occurs more than 25% of the time. Return that integer. Constraints: 1 <= arr.length <= 10^4 0 <= arr[i] <= 10^5 """ class Solution...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ib.ext.cfg.CommissionReport -> config module for CommissionReport.java. """
class Solution: def plusOne(self, digits): """ 66. Plus One https://leetcode.com/problems/plus-one """ for i in range(len(digits)): if digits[-i] < 9: digits[-i] += 1 return digits digits[-i] = 0 return [1] + [0]...
# Copyright 2015 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. { 'variables': { 'chromium_code': 1, }, 'targets': [], 'conditions': [ # The CrNet build is ninja-only because of the hack in # ios/build...
input = """ d(1). d(2). d(3). d(4) :- #count{V : d(V)} > 2. """ output = """ d(1). d(2). d(3). d(4) :- #count{V : d(V)} > 2. """
def parse_map(in_file): with open(in_file) as f: lines = f.read().splitlines() width = len(lines[0]) height = len(lines) points = {} for x in range(width): for y in range(height): points[(x, y)] = lines[y][x] return points, width, height def solve(in_file): (poi...
tick = "✓" cross = "✘" enter_key = "⏎" up = "↑" down = "↓" left = "←" right = "→" division = "÷" multiplication = "×" _sum = "∑" _lambda = "λ"
"""125. Backpack II """ class Solution: """ @param m: An integer m denotes the size of a backpack @param A: Given n items with size A[i] @param V: Given n items with value V[i] @return: The maximum value """ def backPackII(self, m, A, V): # write your code here dp = [[float('...
a1=input("whats your age") a2=input("whats your age") int(a1) int(a2) age=int(a1)-int(a2) print(abs(age))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ # Meta-info Author: Nelson Brochado Created: 05/09/2015 Updated: 28/09/2017 # Description Ternary-search tries (or trees) combine the time efficiency of other tries with the space efficiency of binary-search trees. An advantage compared to hash maps is that tern...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # This combines configurable build-time constants (documented on REPO_CFG # below), and non-configurable constants that are currently not name...
# -*- coding: utf-8 -*- DESC = "cpdp-2019-08-20" INFO = { "BindAcct": { "params": [ { "name": "MidasAppId", "desc": "聚鑫分配的支付主MidasAppId" }, { "name": "SubAppId", "desc": "聚鑫计费SubAppId,代表子商户" }, { "name": "BindType", "desc": "1 – 小额转账验证\...
# 比较两个版本号 version1 和 version2。 # 如果 version1 > version2 返回 1,如果 version1 < version2 返回 -1, 除此之外返回 0。 # 你可以假设版本字符串非空,并且只包含数字和 . 字符。 #  . 字符不代表小数点,而是用于分隔数字序列。 # 例如,2.5 不是“两个半”,也不是“差一半到三”,而是第二版中的第五个小版本。 # 你可以假设版本号的每一级的默认修订版号为 0。 # 例如,版本号 3.4 的第一级(大版本)和第二级(小版本)修订号分别为 3 和 4。其第三级和第四级修订号均为 0。 #   # 示例 1: # 输入: version1 = ...
# Time: O(n) # Space: O(1) class Solution(object): def isSelfCrossing(self, x): """ :type x: List[int] :rtype: bool """ if len(x) >= 5 and x[3] == x[1] and x[4] + x[0] >= x[2]: # Crossing in a loop: # 2 # 3 ┌────┐ # └─══...
""" Erik Meijer. 2014. The curse of the excluded middle. Commun. ACM 57, 6 (June 2014), 50-55. DOI=10.1145/2605176 http://doi.acm.org/10.1145/2605176 """ with open('citation.txt', encoding='ascii') as fp: get_contents = lambda: fp.read() print(get_contents())
t=int(input()) P=[] answer=[] while(t!=0): N,K=map(int, input().split()) P=list(map(int, input().split())) P.sort() for j in range(N): if(P[j]<=K and K%P[j]==0): answer.append(P[j]) elif(P[j]>K): break else: continue #answer t...
class newsArticles: ''' Class defining articles ''' def __init__(self, source, author, title, description, url, image_url, publish_time, content): self.source = source # Name of the source of news self.author = author # Author of the news article self.title = title # Title o...
nota1=float(input('digite sua primeira nota:')) nota2=float(input('digite sua segunda nota')) media=(nota1+nota2)/2 print('sua média é ', media)
# There are three type methods # Instance methods # Class methods # Static methods class Student: school = "Telusko" @classmethod def get_school(cls): return cls.school @staticmethod def info(): print("This is Student Class") def __init__(self, m1, m2, m3): self.m1 = ...
def method1(arr: list, n: int) -> list: longest = 1 cnt = 1 for i in range(n - 1): if (arr[i] + arr[i + 1]) % 2 == 1: cnt = cnt + 1 else: longest = max(longest, cnt) cnt = 1 if longest == 1: return 0 return max(cnt, longest) if __name__ =...
# Find the Access Codes # ===================== # In order to destroy Commander Lambda's LAMBCHOP doomsday device, you'll need access to it. But the only door leading to the LAMBCHOP chamber is secured with a unique lock system whose number of passcodes changes daily. Commander Lambda gets a report every day that incl...
a,b,c=list(map(int, input().split())) arr=[a,b,c] arr=sorted(arr) print(arr[0],arr[1],arr[2])
class TaskDTO: task_id = None name = None args = None running = None def __init__(self, task): self.task_id = task["id"] self.name = task["name"].split(".")[-1] self.args = task["args"] self.running = task["time_start"] is not None
class Socks5Error(Exception): pass class NoVersionAllowed(Socks5Error): pass class NoCommandAllowed(Socks5Error): pass class NoATYPAllowed(Socks5Error): pass class AuthenticationError(Socks5Error): pass class NoAuthenticationAllowed(AuthenticationError): pass
"""Slide"""
"""Linkedlist implementation.""" class Node(object): """Node class.""" def __init__(self, initdata=None): """Initialization.""" self.data = initdata self.next = None def getData(self): """Get node's data.""" return self.data def setData(self, data): "...
# Copy and rename this file to settings.py to be in effect. # Maximum total number of files to maintain/copy in all of the batch/dst directories. LIMIT = 1000 # How many seconds to sleep before checking for the above limit again. # If the last number is reached and the check still fails, # then the whole script will ...
""" Constant values used throughout the app. """ CALLBACK_PATH = '/v1/das/callback' ACQUISITION_PATH = '/rest/das/requests' GET_REQUEST_PATH = ACQUISITION_PATH + '/{req_id}' DOWNLOAD_CALLBACK_PATH = CALLBACK_PATH + '/downloader/{req_id}' DOWNLOADER_PATH = '/rest/downloader/requests' METADATA_PARSER_PATH = '/rest/metad...
# @Title: 二叉树的最大深度 (Maximum Depth of Binary Tree) # @Author: KivenC # @Date: 2018-12-02 22:04:32 # @Runtime: 64 ms # @Memory: N/A # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def m...
matrix = [input().split() for row in range(int(input()))] primary_diagonal_sum = 0 for i in range(len(matrix)): primary_diagonal_sum += int(matrix[i][i]) print(primary_diagonal_sum)
class TaskMixin: def _get_is_labeled_value(self): n = self.completed_annotations.count() return n >= self.overlap
class Vehicle: DEFAULT_FUEL_CONSUMPTION = 1.25 def __init__(self, fuel, horse_power): self.fuel = fuel self.horse_power = horse_power self.fuel_consumption = self.DEFAULT_FUEL_CONSUMPTION def drive(self, kilometers): fuel_needed = kilometers * self.fuel_consumption ...
"""Top-level package for climinteractive.""" __author__ = """Bjoern Mayer""" __email__ = 'bjoern.mayer@mpimet.mpg.de' __version__ = '0.1.0'
#dictionary Person = {'personID': 0, 'firstName': "", 'lastName': "", 'Account': {'accountNumber': 0, 'accountType': 0, 'money': 0, 'limit': 0} } def inputPerson(): Person['personID'] = int(input("Enter Custom...
for _ in range(int(input())): a, b, c = map(int, input().split()) if a < b - c: print("advertise") elif a == b - c: print("does not matter") else: print("do not advertise")
# 🚨 Don't change the code below 👇 year = int(input("Which year do you want to check? ")) # 🚨 Don't change the code above 👆 #Write your code below this line 👇 if year%4==0: if year%100==0: if year%400==0: isleap=True else: isleap=False else: isleap=True else...
# define options CONF_SPEC = { 'optgroup': None, 'urls_conf': None, 'public': False, 'plugins': [], 'widgets': [], 'apps': [], 'middlewares': [], 'context_processors': [], 'dirs': [], 'page_extensions': [], 'auth_backends': [], 'js_files': [], 'js_spec_files': [], ...
a=int(input("enter a levels ")) u=0 lis=[] i=1 while i<=a: print("\n") d=a if(i==4): u=0 if(i<=3): #k=i lis.append(i) u=i else: u=u+sum(lis) while d>=i: print(" ",end="\t") d=d-1 for j in range(1,i+1): ...
# URL of server application root BASE_URL = 'https://printer.nsychev.ru/' # Secret token, same as server one TOKEN = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' # Path to print executable PRINT_BIN = 'PDFtoPrinter.exe' # Printer name PRINTER = 'Hewlett-Packard HP LaserJet Pro MFP M125ra'
expected_output = { 'nodes': { 1: { 'te_router_id': '192.168.0.4', 'host_name': 'rtrD', 'isis_system_id': [ '1921.68ff.1004 level-1', '1921.68ff.1004 level-2', '1921.68ff.1004 level-2'], 'asn': [ ...
# @Author: shenmaoyuan # @Date: 2018-07-30T04:37:01+09:00 # @Email: disovery.yuan@gmail.com # @Last modified by: shenmaoyuan # @Last modified time: 2018-08-01T04:23:59+09:00 # @License: Licensed under the Apache License, Version 2.0 (the "License") # @Copyright: Copyright (c) 2017 XXXXXX, Inc. class Maze(object):...
# Copyright 2010 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
# -*-coding:utf-8 -*- #Reference:********************************************** # @Time    : 2019-11-15 11:14 # @Author  : Fabrice LI # @File    : 20191115_binary_search.py # @User    : liyihao # @Software : PyCharm # @Description: default module binary search #Reference:********************************************...
# coding: utf-8 pedido, quant = input().split(" ") pedido, quant = int(pedido), float(quant) valor = 0 if pedido == 1: valor = 4.0 elif pedido == 2: valor = 4.5 elif pedido == 3: valor = 5.0 elif pedido == 4: valor = 2.0 elif pedido == 5: valor = 1.5 print('Total: R$ {:.2f}'.format(valor * quant)...
class SimpleList: def __init__(self, items): self._items = list(items) def add(self, item): self._items.append(item) def __getitem__(self, index): return self._items[index] def sort(self): self._items.sort() def __len__(self): return len(self._items) def __repr__(self): return "...
class Solution: """ The Brute Force Solution Time Complexity: O(N^3) Space Complexity: O(1) """ def countGoodTriplets(self, arr: List[int], a: int, b: int, c: int) -> int: triplet_count = 0 # for each i, for each j, check if the first condition is satisfied for i in r...
class Error(Exception): """Base class for exceptions in this module.""" pass class Parse(Error): """ Error parsing the program""" pass class Output(Error): """ Error parsing the program""" pass class Symbol(Error): """ Error parsing the program""" pass
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. # SPDX-License-Identifier: Apache-2.0 load("@bazel_skylib//lib:paths.bzl", "paths") daml_provider = provider(doc = "DAML provider", fields = { "dalf": "The DAML-LF file.", "dar": "The packaged archive.", "src...
class ClientEvent(object): AUTH = 1 MODEL_PARAM = 2 EVAL_PARAM = 3 DURATION_PARAM = 4 EXPERIMENT_START = 5 EXPERIMENT_END = 6 CODE_FILE = 7 COMPLETED = 10 GET_EXPERIMENT_METRIC_FILTER = 8 GET_EXPERIMENT_METRIC_DATA = 9 GET_EXPERIMENT_DURATION_FILTER = 11 GET_EXPERIMENT_DU...
input = """ num(2). node(a). p(N) :- num(N), #count{Y:node(Y)} = N1, <=(N,N1). """ output = """ {node(a), num(2)} """
class DNS: def start(self): raise NotImplemented() def stop(self): raise NotImplemented() def restart(self): raise NotImplemented() def cleanCache(self): raise NotImplemented() def addRecord(self): raise NotImplemented() def deleteHost(self, host): ...
# Copyright (c) 2020-2021 by Fraunhofer Institute for Energy Economics # and Energy System Technology (IEE), Kassel, and University of Kassel. All rights reserved. # Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. # physical constants GRAVITATION_CONSTANT = 9.81 # ear...